Skip to content

Commit

Permalink
Ci fix keyvault (#23)
Browse files Browse the repository at this point in the history
* key vault check fix

* key vault fix

* key vault fix

* key vault check fix

---------

Co-authored-by: Ubuntu <azureuser@depa-vm.recd55or1vaelbcbtp40w0dgvg.bx.internal.cloudapp.net>
  • Loading branch information
pavankad and Ubuntu authored Nov 17, 2024
1 parent a25f1a6 commit b0313d5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scenarios/covid/data/2-create-akv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ if [[ "$AZURE_KEYVAULT_ENDPOINT" == *".vault.azure.net" ]]; then
AZURE_AKV_RESOURCE_NAME=`echo $AZURE_KEYVAULT_ENDPOINT | awk '{split($0,a,"."); print a[1]}'`
# Check if the Key Vault already exists
echo "Checking if Key Vault $KEY_VAULT_NAME exists..."
KEY_VAULT_EXISTS=$(az keyvault list --resource-group $AZURE_RESOURCE_GROUP --query "[?name=='$AZURE_AKV_RESOURCE_NAME'].name" --output tsv)
if [ -z "$KEY_VAULT_EXISTS" ]; then
NAME_AVAILABLE=$(az rest --method post \
--uri "https://management.azure.com/subscriptions/$AZURE_SUBSCRIPTION_ID/providers/Microsoft.KeyVault/checkNameAvailability?api-version=2019-09-01" \
--headers "Content-Type=application/json" \
--body "{\"name\": \"$AZURE_AKV_RESOURCE_NAME\", \"type\": \"Microsoft.KeyVault/vaults\"}" | jq -r '.nameAvailable')
if [ "$NAME_AVAILABLE" == true ]; then
echo "Key Vault $KEY_VAULT_NAME does not exist. Creating it now..."
# Create Azure key vault with RBAC authorization
az keyvault create --name $AZURE_AKV_RESOURCE_NAME --resource-group $AZURE_RESOURCE_GROUP --sku "Premium" --enable-rbac-authorization
Expand Down

0 comments on commit b0313d5

Please sign in to comment.