Azure Key Vault: access, network and recovery
Azure Key Vault is a managed store for secrets (passwords, connection strings), keys (for encryption and signing) and certificates, with Microsoft Entra authentication, auditing and recovery built in. The decision rule for exams: an app should read a secret at run time using a managed identity that holds a data-plane role such as Key Vault Secrets User, never a stored credential; control-plane roles manage the vault but do not read its contents; and soft delete plus purge protection, not backups, are what make a deleted object recoverable.
Four gates a request passes
Think of every call to a vault as passing four checks. Most exam questions fail at exactly one of them.
| Gate | Question it answers | Typical setting |
|---|---|---|
| 1. Network | Can the caller reach the vault endpoint? | Firewall, private endpoint, public access disabled |
| 2. Authentication | Who is calling? | Microsoft Entra identity, usually a managed identity |
| 3. Authorization | What may this identity do? | Azure RBAC role (or a legacy access policy) |
| 4. Lifecycle | What survives a delete or a rotation? | Soft delete, purge protection, versions |
Gate 1: network
By default a new vault has its firewall disabled, so all networks can send requests to it. That does not make it open: callers still need to authenticate and be authorized (network security for Key Vault). When you enable the firewall you can allow IPv4 ranges, allow specific virtual network subnets through a service endpoint, or use a private endpoint and disable public access. The option “Allow trusted Microsoft services to bypass this firewall” lets listed first-party services through, and Learn states that this bypass still applies when public network access is disabled. Services not on that list, Azure DevOps being the documented example, are blocked and need a private endpoint. The firewall governs data-plane calls only; ARM template deployments of secrets use the control plane and are not blocked by it.
To choose between a service endpoint and a private endpoint, see private endpoint vs service endpoint.
Gates 2 and 3: identity and roles
Key Vault has two planes. The control plane (management.azure.com) creates and configures vaults. The data plane (the vault’s own URL) reads and writes secrets, keys and certificates. They are authorized separately (Azure RBAC for Key Vault).
Azure RBAC is the recommended model for data-plane access. Starting with API version 2026-02-01, new vaults default to Azure RBAC. Existing vaults keep their current model unless you change it, and access policies remain supported (access control default). Older control-plane API versions retire on February 27, 2027.
| Role | What it does |
|---|---|
| Key Vault Contributor | Control plane only; cannot read keys, secrets or certificates |
| Key Vault Administrator | All data-plane operations on all objects |
| Key Vault Secrets Officer | Any action on secrets, except managing permissions |
| Key Vault Secrets User | Read secret contents |
| Key Vault Reader | Read metadata only, not secret values or key material |
| Key Vault Crypto User | Perform cryptographic operations with keys |
| Key Vault Certificates Officer | Any action on certificates, except managing permissions |
Two traps. First, Contributor on the vault resource is not data access under RBAC. Under the older access policy model, though, a user with Contributor on the control plane can grant themselves data-plane access by editing access policies, which is why Learn says to restrict that role tightly. Second, switching a vault to RBAC invalidates all its access policy permissions, which can cause an outage if equivalent roles are not assigned first.
Learn recommends one vault per application per environment, with roles assigned at vault scope. For how the identity itself is created, see managed identities vs service principals, and for how RBAC scopes work in general, Azure RBAC vs Entra roles.
Gate 4: lifecycle
Soft delete is on for new vaults and cannot be turned off once enabled. A deleted vault or object stays recoverable for a retention period of 7 to 90 days, default 90, set at creation and not changeable afterwards. Purging an object in the soft-deleted state needs a purge permission, for example the Key Vault Purge Operator role. Purge protection is optional and off by default: when on, nothing can be purged until the retention period ends, even by someone with purge rights (soft delete). Learn notes that most Azure services that use vault keys for encryption, Storage for example, require purge protection. A soft-deleted vault name cannot be reused until retention expires.
Secrets also have versions. Fetching a secret by name returns the current version; fetching by version returns that exact value.
Worked example: web app to vault
- Create a vault
kv-orders-prodwith RBAC authorization and soft delete (default). - Store a secret
SqlConnection. - Turn on the web app’s system-assigned managed identity.
- Assign that identity Key Vault Secrets User at the vault scope.
- Add an app setting whose value is
@Microsoft.KeyVault(VaultName=kv-orders-prod;SecretName=SqlConnection).
The app now reads an ordinary environment variable. Without a version in the reference, App Service picks up a new secret version within 24 hours, because it refetches every 24 hours; any app configuration change restarts the app and refetches at once (Key Vault references). If the vault has a firewall, the app must reach it through a virtual network the vault allows, not through the app’s public outbound IPs. An unresolved reference shows up as the literal reference text, which is the symptom to recognise. For where the app itself runs, see App Service plans.
Which exams test this
| Exam | How it appears | Where on this site |
|---|---|---|
| SC-500 | “Manage identity, access, and governance” (20-25%), group “Secure secrets and keys by using Azure Key Vault”: deploy, settings, access, firewall, manage keys, secrets and certificates, scan for secrets with Defender CSPM, Defender for Key Vault | Identity, access and governance explained |
| AI-200 | “Secure, monitor, and troubleshoot Azure solutions” (20-25%): secure secrets with Key Vault, including rotation and retrieval | Secure, monitor, troubleshoot explained |
| AZ-400 | “Develop a security and compliance plan” (10-15%): manage secrets, keys and certificates with Key Vault. Outline as of July 27, 2026. | Security and compliance explained |
| AZ-305 | “Design identity, governance, and monitoring solutions” (25-30%): recommend a solution to manage secrets, certificates and keys | Identity, governance, monitoring explained |
| SC-900 | “Capabilities of Microsoft security solutions” (35-40%): describe Key Vault. Outline applies from October 21, 2026. | Microsoft security solutions explained |
| DP-750 | “Secure and govern Unity Catalog objects” (15-20%): access Key Vault secrets from Azure Databricks. Outline applies from October 19, 2026. | Unity Catalog security explained |
How exam questions are built around Key Vault
- Remove the stored credential. If one option uses a managed identity and the others keep a secret in app settings, a pipeline variable or code, the identity option wins.
- Least privilege by verb. “Read a secret” is Secrets User. “Create and rotate secrets” is Secrets Officer. “Manage the vault” is Key Vault Contributor, which cannot read values. “See that a secret exists” is Reader.
- Recover versus protect. “Recover an accidentally deleted secret” is soft delete. “Nobody, including administrators, may permanently delete before retention ends” is purge protection.
- Layering. A vault with RBAC but open to every network is still a finding. Add a private endpoint or firewall.
- Throttling. Calling the vault on every request invites 429 responses; the documented limit for most secret operations is 4,000 per 10 seconds per vault per region, so cache values in the app (service limits).
Practice questions
Question 1. A web app hosted in App Service must read a database connection string stored in a vault that uses Azure RBAC. No credentials may be stored in the app, and the app must get only the access it needs. What should you do?
- A. Enable a managed identity on the app and assign it Key Vault Secrets User on the vault
- B. Enable a managed identity on the app and assign it Key Vault Contributor on the vault
- C. Enable a managed identity on the app and assign it Key Vault Reader on the vault
- D. Enable a managed identity on the app and assign it Key Vault Secrets Officer on the vault
Show answer
Answer: A
A managed identity removes the stored credential, and Key Vault Secrets User lets it read secret contents and nothing more. Key Vault Contributor is a control-plane role and cannot read secret values. Key Vault Reader reads metadata only, not the secret itself. Secrets Officer works but also lets the app create and delete secrets, which exceeds the requirement.
Question 2. Soft delete is enabled on a key vault. Security requires that no user, including those with purge permission, can permanently delete a soft-deleted key before the retention period ends. What should you enable?
- A. Soft delete, because it is currently disabled
- B. The key vault firewall
- C. Key Vault Reader for all administrators
- D. Purge protection
Show answer
Answer: D
Purge protection blocks purging of deleted vaults and objects until the retention period has passed, whoever asks. Soft delete is already on by default and cannot be switched off, and on its own still allows a privileged user to purge. A key vault firewall limits network access, not deletion. A Reader role assignment limits what one user can do and does not stop others with purge rights.
Go deeper
- Azure RBAC for Key Vault data plane (built-in roles, scopes)
- Key Vault soft delete and purge protection
- Network security for Key Vault
- Key Vault references for App Service and Functions
- Related guides: Azure Policy vs RBAC vs locks, SAS tokens and stored access policies, Azure Functions triggers and bindings