All guides

Azure Key Vault: access control, private access and rotation

Access to a key vault has two parts: who may read a secret, and which networks a request may come from. Azure RBAC controls the first. The Key Vault firewall and private endpoints control the second.

Lines of code on a screen, coloured by syntax

Azure RBAC or access policies

Key Vault offers two authorization systems for its data plane. The access policy model is a legacy system, native to Key Vault, that assigns permissions to security principals at Key Vault scope. Azure RBAC uses role assignments. Microsoft recommends Azure RBAC.

The difference Microsoft stresses is who can grant access:

  • Under access policies, data plane access is something a user can grant to themselves if they hold Contributor, Key Vault Contributor or any other role with Microsoft.KeyVault/vaults/write.
  • Under Azure RBAC, only a member of the Owner or User Access Administrator role can grant access to keys, secrets and certificates.

New key vaults created through API version 2026-02-01 or later use Azure RBAC as their access control model by default. The default applies only to create operations, and existing vaults keep their current model. To use access policies for a new vault, set enableRbacAuthorization to false at creation time.

Microsoft retires every Key Vault control plane API version older than 2026-02-01 on February 27, 2027. Microsoft says to upgrade to Azure CLI 2.90.0 or later, which supports the new API version.

Setting the Azure RBAC permission model on an existing vault invalidates all access policy permissions, which can cause outages when equivalent Azure roles are not assigned.

The built-in roles

  • Key Vault Secrets User reads secret contents.
  • Key Vault Secrets Officer may do anything with a key vault's secrets apart from managing permissions.
  • Key Vault Crypto User performs cryptographic operations using keys, and Key Vault Crypto Officer performs any action on keys, except managing permissions.
  • Key Vault Certificate User reads entire certificate contents, and Key Vault Certificates Officer performs any action on certificates, except managing permissions.
  • Key Vault Reader reads metadata and cannot read sensitive values.
  • Key Vault Administrator performs all data plane operations and cannot manage role assignments.
  • Key Vault Contributor is for control plane operations only. Keys, secrets and certificates stay out of its reach.

Shell

VAULT_ID="/subscriptions/<subscription-id>/resourceGroups/<resource-group>"
VAULT_ID="$VAULT_ID/providers/Microsoft.KeyVault/vaults/<vault-name>"

az role assignment create --role "Key Vault Secrets User" \
  --assignee <object-id> --scope "$VAULT_ID"

--assignee accepts an object ID, a user sign-in name or a service principal name. Microsoft does not recommend assigning roles on individual keys, secrets and certificates.

The firewall and private endpoints

A newly created key vault has its firewall turned off by default. Any application or Azure service can then send requests to the vault, and each request still needs Microsoft Entra authentication and permissions.

Shell

az keyvault update --resource-group <resource-group> --name <vault-name> --default-action Deny

az keyvault update --resource-group <resource-group> --name <vault-name> \
  --public-network-access Disabled
  • Default action Deny. With firewall rules in effect, a data plane operation succeeds only if the request comes from an allowed virtual network or an allowed IPv4 address range.
  • Public access disabled. The vault is then accessible only through private endpoints. Microsoft says to ensure your private endpoint configuration is complete before you disable public access.
  • Trusted services. --bypass AzureServices lets trusted Microsoft services bypass the firewall. The trusted services list does not cover every Azure service. Azure DevOps is not on it.
  • Data plane only. Key Vault firewall rules apply only to data plane operations. Control plane operations are not subject to them.

Soft delete and purge protection

When you create a new key vault, soft delete is on by default. Once it is enabled, it cannot be disabled. A deleted vault, key, secret or certificate remains recoverable for a period of 7 to 90 days, and 90 days is the default. The interval can only be configured during key vault creation.

Purge protection is not enabled by default. While it is on, nothing in the deleted state, vault or object, can be purged before the retention period ends. The Azure CLI help states that enabling it is irreversible. Microsoft recommends purge protection when using keys for encryption, and says most Azure services that integrate with Key Vault, such as Storage, require it.

Shell

az keyvault create --resource-group <resource-group> --name <vault-name> \
  --location <location> --enable-rbac-authorization true \
  --enable-purge-protection true --retention-days 90

When a vault is soft-deleted, its Azure RBAC role assignments and Event Grid subscriptions are deleted. Recovering the vault does not restore them.

Rotation

  • Keys. A rotation policy automatically generates new key versions at the frequency you specify. The minimum rotation interval is seven days.
  • Secrets. Autorotation of a secret is set up with an Azure Function that an Event Grid event triggers. Microsoft documents two scenarios: resources with one set of authentication credentials, and resources with two sets.

One vault per application and environment

Microsoft recommends one vault for each application in each environment (Development, Pre-Production and Production) and role assignments made at the scope of the key vault.

Its RBAC guide says role assignments on individual objects do not isolate application teams inside one vault. Administrative operations such as network access control and monitoring require vault-level permissions.

What to check on an existing vault

  1. Check the permission model with az keyvault show, and look at the enableRbacAuthorization property.
  2. Review who holds Owner or User Access Administrator, the roles that can grant access.
  3. Confirm that public network access is disabled, or that the default action is Deny.
  4. Confirm that purge protection is on.
  5. Set enableRbacAuthorization explicitly in templates that create vaults, and move them to API version 2026-02-01 or later before February 27, 2027.

Sources

Want a second pair of eyes on yours? We do this work for a living.

Book a call

More guides