L3. Securing Secrets and Keys with Azure Key Vault: Access, Firewalls & Defender for Key Vault
Video generating
Check back soon for the video lesson on Securing Secrets and Keys with Azure Key Vault: Access, Firewalls & Defender for Key Vault
Course outlineLesson 3 of 18
A Key Vault is only as secure as its access model and network exposure, and Defender for Key Vault is what actually notices when a legitimate credential starts behaving like a stolen one.
Vault vs. Managed HSM
Azure offers two Key Vault deployment models:
- Key Vault (standard/premium): multi-tenant HSM-backed or software-backed store for keys, secrets, and certificates
- Managed HSM: a single-tenant, dedicated FIPS 140-2 Level 3 validated HSM pool, used when compliance requires full control over the underlying hardware security module
Access Model: Access Policies vs. Azure RBAC
Key Vault data-plane access (getting/setting actual keys, secrets, certificates) can be controlled two ways:
| Model | How it works |
|---|---|
| Vault access policies | Legacy model: grant specific key/secret/certificate permissions directly on the vault, per principal |
| Azure RBAC for Key Vault data plane | Modern model: use standard Azure role assignments (e.g., Key Vault Secrets User, Key Vault Administrator) scoped like any other Azure resource, auditable through Azure Activity Log |
Configuring the Key Vault Firewall
By default, a vault is reachable from the public internet. Locking it down involves:
- Private endpoint: gives the vault a private IP inside your VNet; the recommended approach for production
- Virtual network service endpoints: restrict access to specific subnets without a private IP
- Trusted Microsoft services: an allowlist bypass for specific first-party Azure services (like Azure Backup or Azure Resource Manager deployment) that need vault access even with the firewall otherwise set to deny public access
- Firewall default action: Deny, with explicit allowed IP ranges or the trusted-services bypass as the only exceptions
Managing Keys, Secrets, and Certificates
- Soft-delete (mandatory on all vaults) retains deleted items for a retention period, and purge protection prevents even a Owner/Contributor from permanently destroying them before that period elapses, protecting against a malicious or accidental permanent deletion
- Rotation policies on keys automate rotation on a schedule instead of relying on manual key rollover
- Certificate lifecycle management in Key Vault can auto-renew certificates issued by an integrated CA and notify configured contacts before expiration
Scanning for Secrets with Defender CSPM
Defender Cloud Security Posture Management (Defender CSPM) includes agentless scanning that inspects VM disks and containers for plaintext secrets, keys, and credentials left in code or config files, not just what's properly stored in Key Vault. Findings surface as recommendations pointing to exactly which VM and file path contains the exposed secret, closing the gap where developers hardcode a credential instead of retrieving it from the vault.Defender for Key Vault
Defender for Key Vault is the workload protection plan specific to Key Vault. It analyzes the operations performed against your vaults and alerts on anomalous patterns such as:- Access from a Tor exit node or another unusual/suspicious IP
- An unusual volume of secret retrievals in a short window (a sign of automated exfiltration)
- Access patterns inconsistent with the calling application's normal behavior
These alerts surface in Defender for Cloud alongside other workload protection alerts, giving a unified view of vault-specific threats. Exam tip: SC-500 draws a clear line between *preventive* controls (RBAC data-plane model, firewall, private endpoint, soft-delete/purge protection) and *detective* controls (Defender for Key Vault alerting on anomalous access, Defender CSPM finding hardcoded secrets outside the vault entirely).
- ✓Azure RBAC for Key Vault data plane is the recommended access model over legacy vault access policies, unifying management- and data-plane authorization
- ✓Key Vault firewall should default-deny public access, using private endpoints or VNet service endpoints, with trusted Microsoft services as the only bypass
- ✓Soft-delete plus purge protection together prevent a permanent, irreversible deletion of vault contents within the retention window
- ✓Defender CSPM agentless scanning finds plaintext secrets hardcoded in VM disks or containers, a gap Key Vault itself cannot close since those secrets never touched the vault
- ✓Defender for Key Vault alerts on anomalous access patterns (unusual IPs, abnormal retrieval volume) rather than preventing access outright
1. Which Key Vault access model unifies management-plane and data-plane permissions under standard Azure role assignments, and integrates with PIM for just-in-time elevation?
2. A vault has soft-delete and purge protection both enabled. What does purge protection specifically add on top of soft-delete?
3. A developer hardcoded a database connection string with a plaintext password directly into a script on a VM disk, bypassing Key Vault entirely. Which capability is designed to detect this?
Recommended: Pluralsight
This free course covers the theory. Pluralsight adds structured Cloud and AI Security Engineer learning paths, hands-on Azure and Defender for Cloud labs, and timed practice exams to make it stick before exam day.