Key Vault requires a subscription
az login required
npm install @azure/keyvault-secrets @azure/identity
Provision an Azure Key Vault with soft-delete and purge protection. Store a database connection string as the first secret.
1 #!/bin/bash 2 set -e 3 4 VAULT_NAME="myapp-kv-${RANDOM}" 5 RG="rg-myapp" 6 7 # Create Key Vault with security best practices 8 az keyvault create --name "$VAULT_NAME" --resource-group "$RG" --sku standard --enable-purge-protection true --retention-days 90 --enable-rbac-authorization true # Use RBAC instead of vault access policies 9 10 echo "Key Vault created: $VAULT_NAME" 11 echo "VAULT_URL=https://$VAULT_NAME.vault.azure.net" >> .env.local 12
Key Vault created; secret stored and retrievable via CLI
Sign in to share your feedback and join the discussion.