Switching a Key Vault to RBAC Keeps Old Access Policies, Inactive but Not Deleted
Overview
Switching Azure Key Vault to RBAC authorisation does not delete existing access policies. They are kept but inactive while RBAC is enabled, so stale entries should still be reviewed and deliberately removed.
At a glance
- Symptom
- After changing an Azure Key Vault's permission model from vault access policies to Azure RBAC, a security reviewer expects legacy grants to stop working.
- Likely cause
- Azure Key Vault historically supports two mutually exclusive authorisation models: vault access policies and Azure RBAC, selected by the enableRbacAuthorization boolean on the vault…
- Impact
- Secret, key and certificate access intended to be gated behind deliberate RBAC role assignments remains available to identities holding an unexpected inherited or group-based role assignment, and stale…
- Verification signal
- Re-run the vault property query and confirm the access policy array is empty and that the previously successful unauthorised read now fails with an authorisation error.az keyvault show…
- Safe correction
- Assign equivalent least-privilege RBAC roles to the identities that still require access, remove unexpected role assignments, then remove every stale access policy entry explicitly so none can become…
- Rollback or recovery
- If a dependent application breaks because it relied on an undocumented legacy grant, restore only that specific access policy entry rather than reverting the vault to the access-policy…
Symptom
After changing an Azure Key Vault’s permission model from vault access policies to Azure RBAC, a security reviewer expects legacy grants to stop working. Testing shows otherwise: a service principal never assigned an RBAC role can still retrieve secrets, keys or certificates. Diagnostic logs record successful secret-read operations from identities the team believed were fully deprovisioned during the migration.
False Assumption
The team assumed that setting the vault’s enableRbacAuthorization property to true immediately and completely supersedes the old access policy list, and that policies no longer editable in the Azure Portal grant no access. In practice, setting this property to true does mean that access policies are no longer evaluated and only RBAC applies. However, Microsoft documents only that the RBAC model invalidates access policy permissions, not that the entries are deleted: check whether they are still present in the resource, and treat any that remain as able to become active again if the vault were switched back to the access policy model. A successful read by an identity with no RBAC role on the vault therefore points to an RBAC assignment (possibly inherited or group-based) or a different cause, not to an honoured access policy.
Root Cause
Azure Key Vault historically supports two mutually exclusive authorisation models: vault access policies and Azure RBAC, selected by the enableRbacAuthorization boolean on the vault resource. The likely cause of the unexpected access is an RBAC role assignment that the team did not expect, for example one inherited from a subscription or resource group, or granted through a group. Separately, teams often change the property without a documented step to enumerate and remove existing access policy entries. Those stale entries are inactive under RBAC, but they remain a latent risk if the vault is ever switched back to the access policy model. Without an explicit inventory of prior permissions granted under the old model, the security team has no baseline to confirm legacy access has actually been revoked.
Impact
Secret, key and certificate access intended to be gated behind deliberate RBAC role assignments remains available to identities holding an unexpected role assignment, defeating the least-privilege boundary the migration was meant to establish. Stale access policy entries do not grant access while RBAC is enabled, but could become active again on a reversion to the access policy model. Where the vault holds credentials or signing keys for production workloads, reviewers who look only at direct role assignments may miss inherited or group-based assignments and falsely conclude access is fully controlled.
Diagnosis
Confirm the vault’s current authorisation model and inspect for residual access policy entries before drawing conclusions about access control coverage.
az keyvault show --name <vault-name> --resource-group <rg-name> --query "properties.{rbacEnabled:enableRbacAuthorization, accessPolicies:accessPolicies}" -o json
If rbacEnabled is true but the accessPolicies array is non-empty, legacy grants remain present in the resource definition, though inactive. Cross-check against actual data-plane behaviour by attempting a read with a test identity that holds no direct RBAC role on the vault but does appear in the returned access policy list, using a non-production secret created solely for this test.
az keyvault secret show --vault-name <vault-name> --name test-diagnostic-secret
With RBAC enabled, a successful read means the identity holds an RBAC role, possibly inherited from a subscription, resource group or group assignment, or that the cause is something else. It does not show that access policies are being honoured. Check the effective role assignments before concluding anything:
az role assignment list --assignee <object-id> --scope <vault-resource-id> --include-inherited -o table
Treat the CLI or ARM output as the authoritative source for the vault’s property values.
Correction
While RBAC is enabled the stale access policy entries are inactive, so removing them is hygiene rather than an urgent access fix; it prevents them from becoming active again if the model is ever switched back. The unexpected access itself is fixed by removing the RBAC role assignment that grants it. First export the full access policy list and keep it, because a removed policy cannot be recovered without a saved copy (for example, the output of az keyvault show --name <vault-name> --query properties.accessPolicies -o json). Then assign and verify equivalent least-privilege RBAC roles for the identities that still require access, and only afterwards remove the policy entries. Note that az keyvault delete-policy --name <vault-name> --object-id <object-id> is documented for vaults using access policies and may be rejected while enableRbacAuthorization is true. If it is, alternatives are to edit the accessPolicies property through an ARM template or API deployment, or to temporarily revert the model with great caution (this reactivates every saved policy, so do it only in a controlled window and switch back immediately). This is a state-changing, permission-narrowing action and must be performed on one identity at a time with the evidence from Diagnosis in hand, ideally piloted first on a non-production vault.
- Confirm, from the Diagnosis step output, the exact object ID of the identity whose policy entry is being removed and whether it holds a legitimate RBAC role assignment already.
- Assign a scoped RBAC role, such as Key Vault Secrets User, only to identities with a confirmed operational need, verify the identity can still perform its function, and record the object ID, prior permission set and business justification for each change.
- Remove the stale policy entry for that object ID only, then re-query the vault to confirm the array no longer contains it before moving to the next entry.
- For any identity that should not have access, identify the RBAC role assignment (direct, inherited or group-based) shown in the role assignment output and remove it.
Document each removed policy entry, each removed role assignment and each new role assignment independently of the portal view.
Validation
Re-run the vault property query and confirm the access policy array is empty. Then confirm that the previously successful unauthorised read fails, which will happen only once the RBAC role assignment that granted it has been removed.
az keyvault show --name <vault-name> --resource-group <rg-name> --query "properties.accessPolicies" -o json
Expect an empty array. Repeat the diagnostic read from the identity that should no longer have access and expect a Forbidden response, while confirming that legitimate identities with new RBAC role assignments can still read successfully. Retain diagnostic log entries from before and after the change as the audit evidence for this record.
Rollback
If a dependent application breaks because it relied on an undocumented legacy grant, restore access for only that identity, using the saved export, rather than reverting the vault to the access-policy authorisation model wholesale, since a full model reversion re-exposes every other identity still holding a saved policy. Where possible, restore access by re-adding the RBAC role assignment you removed. Apply the minimum permission set that restores the required function, confirm the dependent application recovers, and open a tracked follow-up to migrate that identity to a proper RBAC role assignment on a defined timeline. Stop condition: if more than one identity requires rollback, pause further removals and re-run the full dependency inventory before continuing, since this indicates the pre-change audit was incomplete. Because restoring access is itself a state-changing, permission-widening action, treat it as a deliberate, logged decision requiring the same object-ID-level confirmation used during Correction, not a reflexive full revert.
Prevention
Treat the RBAC authorisation switch and the access policy cleanup as two separate, sequenced change steps, each with its own validation, rather than a single action. Before switching enableRbacAuthorization, export and retain the full access policy list as a permanent record. After switching, schedule an explicit removal pass for every stale entry and verify with a negative-access test, not a portal glance, that unintended access no longer works, including review of inherited and group-based role assignments. Include the access policy array in routine vault configuration audits going forward, since automation or infrastructure-as-code templates that still reference the old model may repopulate it. Declare enableRbacAuthorization explicitly in every ARM, Bicep or Terraform template that deploys the vault: a redeploy or restore from an older template that omits it may put the vault back on the access policy model and reactivate the dormant list, so check the value after each deployment.
Related reading
Read-only check
Check your environment (read-only)
Show a key vault's permission model and any access policies it still holds
Based on vendor documentation; not run by KBY in a test tenant
What it shows: Whether the vault authorises data actions with Azure RBAC or with access policies, and the access policies defined on it.
# Azure CLI, signed in with az login. Both commands only read the vault resource.
az keyvault show --name <vault-name> --resource-group <resource-group> --query properties.enableRbacAuthorization
az keyvault show --name <vault-name> --resource-group <resource-group> --query properties.accessPoliciesHow to read the result
- true: Azure RBAC authorises data actions and the access policies in the vault's properties are ignored.
- false: the vault uses its access policies for data actions.
- A non-empty accessPolicies list on a vault that reports true is not in use, but those policies apply again if the property is set back to false. Inventory them before and after a migration.
- Management actions are always authorised with Azure RBAC, whichever model the vault uses.
You need
- Azure CLI.
- An Azure account that can read the key vault resource.
Vendor documentation used
- az keyvault az keyvault show --name / --resource-group, and what --enable-rbac-authorization controls.
- Microsoft.KeyVault vaults (ARM template reference) properties.enableRbacAuthorization and properties.accessPolicies, and the true and false behaviour.
- Migrate to Azure role-based access control az keyvault show --query properties.accessPolicies to inventory access policies.
The check only reads configuration. Plan any change it points to through your normal change process.
Apply the safer control
Before you change production
Confirm the affected scope, export the current configuration, and test the replacement control in a non-production environment first.
Fix commands and configuration
enableRbacAuthorizationtrueaz keyvault show --name <vault-name> --resource-group <rg-name> --query "properties.{rbacEnabled:enableRbacAuthorization, accessPolicies:accessPolicies}" -o jsonWhen to escalate
Validation and rollback are covered in the sections above.
Escalate
Escalate when the blast radius is uncertain, the control cannot be tested safely, or remediation requires an outage or security exception.
Fixed? Get the next one before it hits you: The KBY Brief
Practical fixes for the systems you run, by email about twice a week. Unsubscribe at any time.
About this page
Credited to
Dates
Published
Last updated
Was this useful?
Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.