Azure Key Vault for Administrators: Secrets, Keys, Certificates, Access Control and Managed Identities
What Key Vault Stores
| Object | Examples |
|---|---|
| Secrets | Passwords, connection strings, API keys |
| Keys | RSA or EC keys for encryption and signing |
| Certificates | TLS certificates with renewal |
Create and Use
bash
az keyvault create -g rg-sec -n kv-demo-482 -l centralindia --enable-rbac-authorization true --retention-days 90 --enable-purge-protection true
az role assignment create --assignee asha@contoso.com --role "Key Vault Secrets Officer" --scope $(az keyvault show -n kv-demo-482 --query id -o tsv)
az keyvault secret set --vault-name kv-demo-482 -n DbPassword --value '<StrongPassword>'
az keyvault secret show --vault-name kv-demo-482 -n DbPassword --query value -o tsv
az keyvault secret list --vault-name kv-demo-482 -o table
Access Control
| Model | Notes |
|---|---|
| Azure RBAC (recommended) | Roles: Key Vault Secrets User, Secrets Officer, Crypto User, Certificates Officer, Administrator, Reader |
| Access policies (older) | Per-vault list of permissions for secrets, keys and certificates |
- Two planes: management plane (create and configure the vault) and data plane (read and write secrets)
- Give apps managed identities and the minimum role (usually Secrets User)
Protection
- Soft delete: deleted vaults and objects can be recovered during retention (7 to 90 days)
- Purge protection: nobody can permanently delete before retention ends. Needed for customer-managed keys
- Back up and monitor with diagnostic logs
bash
az keyvault secret delete --vault-name kv-demo-482 -n DbPassword
az keyvault secret recover --vault-name kv-demo-482 -n DbPassword
az keyvault list-deleted -o table
Network Access
- Use the Key Vault firewall to allow selected VNets and IPs, or a private endpoint with
privatelink.vaultcore.azure.netDNS and disable public access - Allow trusted Microsoft services when needed (for example for backup and disk encryption)
Managed Identities
| Type | Use |
|---|---|
| System-assigned | One resource. Created and deleted with it |
| User-assigned | Shared by many resources, lives independently |
bash
az webapp identity assign -g rg-web -n webapp-demo-482
PID=$(az webapp identity show -g rg-web -n webapp-demo-482 --query principalId -o tsv)
az role assignment create --assignee $PID --role "Key Vault Secrets User" --scope $(az keyvault show -n kv-demo-482 --query id -o tsv)
az webapp config appsettings set -g rg-web -n webapp-demo-482 --settings DB_PASSWORD="@Microsoft.KeyVault(SecretUri=https://kv-demo-482.vault.azure.net/secrets/DbPassword/)"
Now the app reads DB_PASSWORD as an environment variable and the secret value never appears in your code or settings.
Certificates and Rotation
- Key Vault can create or import certificates, auto-renew from integrated CAs and notify before expiry
- Use versionless secret URIs so apps pick up new versions
- Rotate secrets on a schedule and after any exposure
Practice
- Create a vault with RBAC and purge protection
- Store a secret and read it using a managed identity from an App Service
- Delete and recover a secret
- Restrict the vault to a VNet with a private endpoint
Conclusion
Key Vault keeps secrets, keys and certificates safe. Use RBAC with least privilege, managed identities for apps, soft delete and purge protection, and private networking.
Quick Summary: objects; create; access; protection; network; identities; rotation.

