Created
December 17, 2021 15:33
-
-
Save rudolphjacksonm/58214a1f9268d2f0627f18e3f6ca4f57 to your computer and use it in GitHub Desktop.
CosmosDB Rotation Main Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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