You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
az group create -n $AZ_KV_GRP -l $LOC --tags label=$SUFFIX
Create azure key vault
az keyvault create --name $AZ_KV_NAME --resource-group $AZ_KV_GRP
Assign service principal a reader role for the keyvault
az role assignment create --role Reader --assignee $SP_CLIENT_ID --scope /subscriptions/$SUBID/resourcegroups/$AZ_KV_GRP/providers/Microsoft.KeyVault/vaults/$AZ_KV_NAME
Then assign get policies for the secrets && create two key vault secrets with name as dbusername and dbpassword. Provide some secret values
az keyvault set-policy -n $AZ_KV_NAME --secret-permissions get --spn $SP_CLIENT_ID
az keyvault secret set --name dbusername --value=dbadmin --vault-name $AZ_KV_NAME
az keyvault secret set --name dbpassword --value=supersecretpassword --vault-name $AZ_KV_NAME
Create secret based on the appid and appsecret of the service principal
az ad sp delete --id $SP_CLIENT_ID
for rg in $(az group list --tag label=$SUFFIX --query '[].name' | jq -r '.[]'); do echo "Delete Resource Group: ${rg}"; az group delete -n ${rg}; done