Skip to content

Instantly share code, notes, and snippets.

@jacqinthebox
Last active March 4, 2019 20:51
Show Gist options
  • Save jacqinthebox/8d3a5c1665270a408af28478912c9b54 to your computer and use it in GitHub Desktop.
Save jacqinthebox/8d3a5c1665270a408af28478912c9b54 to your computer and use it in GitHub Desktop.
just a silly test script
#!/bin/bash
echo "$PREFIX-data-rg"
PROBING="Server=tcp:$DB_SERVERNAME.database.windows.net,1433;Persist Security Info=False;User ID=$DB_ADMIN_LOGIN;Password=$DB_PASSWORD;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
PROVISION="Server=tcp:$DB_SERVERNAME.database.windows.net,1433;Database=TenantProvision;Persist Security Info=False;User ID=$DB_ADMIN_LOGIN;Password=$DB_PASSWORD;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
TENANT="Server=tcp:$DB_SERVERNAME.database.windows.net,1433;Database={0};Persist Security Info=False;User ID=$DB_ADMIN_LOGIN;Password=$DB_PASSWORD;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
CONFIGURATION_TENANT="Server=tcp:$DB_SERVERNAME.database.windows.net,1433;Database={0};Persist Security Info=False;User ID=$DB_ADMIN_LOGIN;Password=$DB_PASSWORD;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
CONFIGURATION_PROBING="Server=tcp:$DB_SERVERNAME.database.windows.net,1433;Persist Security Info=False;User ID=$DB_ADMIN_LOGIN;Password=$DB_PASSWORD;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
# Convert them to Base64
PROBING_SECRET=$(echo $PROBING | base64 | tr -d '\n')
PROVISION_SECRET=$(echo $PROVISION | base64 | tr -d '\n')
TENANT_SECRET=$(echo $TENANT | base64 | tr -d '\n')
CONFIGURATION_TENANT_SECRET=$(echo $CONFIGURATION_TENANT | base64 | tr -d '\n')
CONFIGURATION_PROBING_SECRET=$(echo $CONFIGURATION_PROBING | base64 | tr -d '\n')
CONNECTION_STRINGS=$(cat <<EOF
apiVersion: v1
kind: Secret
metadata:
name: pca-connectionstrings-secret
type: Opaque
data:
probing-connection-string: $PROBING_SECRET
tenant-connection-string: $TENANT_SECRET
provision-connection-string: $PROVISION_SECRET
pcaconfigurationservice-probing-connection-string: $CONFIGURATION_PROBING_SECRET
pcaconfigurationservice-tenant-connection-string: $CONFIGURATION_TENANT_SECRET
EOF
)
echo "$CONNECTION_STRINGS" > pca-connectionstrings-secret.yaml
cat pca-connectionstrings-secret.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment