Skip to content

Instantly share code, notes, and snippets.

@rudolphjacksonm
Created December 17, 2021 15:33
Show Gist options
  • Save rudolphjacksonm/58214a1f9268d2f0627f18e3f6ca4f57 to your computer and use it in GitHub Desktop.
Save rudolphjacksonm/58214a1f9268d2f0627f18e3f6ca4f57 to your computer and use it in GitHub Desktop.
CosmosDB Rotation Main Function
function main() {
local keyKind=$1
local cosmosDBAccountName=$2
echo "Beginning key rotation on ${cosmosDBAccountName}"
echo "Key: ${keyKind}"
# Rotate key
newConnString=$(rotate_keys "${keyKind}" "${cosmosDBAccountName}" | tail -n 1)
# Test Connectivity with new key
echo "Testing connectivity with new ${keyKind} key..."
test_connectivity "${newConnString}"
# Update Secret in Key Vault
update_keyvault_secret "${keyKind}" "${newConnString}" "${cosmosDBAccountName}"
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment