Secure secrets and keys with Azure Key Vault
Deploying and configuring Key Vault, access with RBAC, firewall and private endpoints, managing keys, secrets and certificates, secrets scanning with Defender CSPM, and Defender for Key Vault.
- 20 min
- 7 concepts
- Try it yourself
- 4-question check
Learn
Key Vault is where an Azure estate keeps its crown jewels: connection strings, API keys, encryption keys and certificates. Securing it means controlling who can reach it on the network, who can read what, and making sure nothing can be permanently destroyed by mistake or malice.
- 1
Deploy Key Vault
Choose Standard (software-protected keys) or Premium (HSM-protected keys, FIPS 140-3 Level 3 validated HSMs), or Managed HSM for single-tenant HSM pools. Use one vault per application per environment to limit blast radius, in the same region as the app.
Remember: HSM-backed keys: Premium or Managed HSM.
- 2
Configure Key Vault settings
Soft delete is always on (7 to 90 days retention). Turn on purge protection so nothing can be permanently deleted before retention ends (it can't be turned off once enabled). Enable access for ARM template deployment, disk encryption or VM deployment only where needed. Send diagnostic logs (AuditEvent) to Log Analytics.
Remember: Purge protection is one-way: once on, always on.
- 3
Configure access to Key Vault
Use the Azure RBAC permission model (recommended) instead of legacy access policies. Control plane roles (Key Vault Contributor) manage the vault but don't grant data access. Data plane roles: Key Vault Administrator, Secrets User, Secrets Officer, Crypto User, Certificates Officer, and more. Scope to individual secrets where possible.
Remember: Key Vault Contributor can't read secrets under RBAC.
- 4
Configure firewall settings on Key Vault
Disable public network access and use a private endpoint with the
privatelink.vaultcore.azure.netDNS zone, or restrict to selected VNets (service endpoints) and IP ranges. Allow trusted Microsoft services to bypass the firewall when needed (for example Azure Backup or Disk Encryption).Remember: Private endpoint + public access disabled.
- 5
Manage keys, secrets, and certificates
Set expiry and activation dates, and rotation policies for keys (automatic rotation). Certificates can be issued by integrated CAs (DigiCert, GlobalSign) or self-signed, with auto-renewal and lifetime actions. Use Event Grid near-expiry events to automate secret rotation. Back up and restore objects within the same geography.
Remember: Automate rotation; never rely on calendar reminders.
- 6
Scan for secrets by using Defender Cloud Security Posture Management (Defender CSPM)
Defender CSPM's agentless secrets scanning finds plaintext secrets (keys, connection strings, passwords) in VM disks, cloud deployments and code repositories (through DevOps security), and highlights them in attack paths and recommendations so you can move them into Key Vault.
Remember: Plaintext secrets on VMs: Defender CSPM secrets scanning.
- 7
Implement Defender for Key Vault
Defender for Key Vault (a workload protection plan) detects unusual access, such as access from a Tor exit node or suspicious IP, unusual volumes of operations, or a user or app accessing a vault it never used before. Alerts go to Defender for Cloud and Defender XDR.
Remember: Unusual vault access patterns: Defender for Key Vault.
Key Vault RBAC roles
| Role | Can do |
|---|---|
| Key Vault Administrator | All data-plane operations |
| Key Vault Secrets Officer | Manage secrets |
| Key Vault Secrets User | Read secret contents |
| Key Vault Crypto User | Use keys for crypto operations |
| Key Vault Reader | Read metadata, not secret values |
| Key Vault Contributor | Manage the vault, not its data |
Try it
Pick the least-privilege Key Vault role.
This interactive part needs JavaScript.
In the portal
- Access configurationAzure portal: Key vaults > your vault > Settings > Access configuration
- NetworkingAzure portal: Key vaults > your vault > Settings > Networking
- Defender plansAzure portal: Microsoft Defender for Cloud > Environment settings > your subscription > Defender plans
Key terms
Click a card to see the definition.
Check your understanding
4 questions. Score 80% or more and these skills are marked as confident in your SC-500 study plan.
Can purge protection be turned off once enabled?
It's irreversible.
Under RBAC, can Key Vault Contributor read secret values?
It's a control-plane role.
Which tier gives HSM-protected keys in a multi-tenant vault?
Premium supports HSM keys.
Which finds plaintext secrets on VM disks?
Agentless scanning of disks.
Sources
- Microsoft Learn: Azure Key Vault security
- Microsoft Learn: Key Vault RBAC
- Microsoft Learn: Soft delete and purge protection
- Microsoft Learn: Agentless secrets scanning
- Microsoft Learn: Defender for Key Vault
Facts in this lesson are from Microsoft Learn. This site isn't affiliated with Microsoft.