Does migrating an Azure Key Vault from access policies to RBAC, require changes in the client app?

Falanga, Rod, DOH 1,275 Reputation points
2026-11-05T22:22:05.46+00:00

I created an Azure Key Vault about 4 years ago. At that time, I chose to use access policies (now called "legacy"), because all I wanted to do was have the values in the key vault read only, so that is how I configured that key vault. Later I looked at RBAC with key vault. I still felt that my choice at the time, was appropriate, as I never want anyone to modify or delete a key or its value, in the key vault.

Now is another push to convert old access policies key vaults to use RBAC. What I'd like to know is when I do go through that process of converting the key vault from access policies to RBAC someday in the future, will it require changes in the code of the client application, which is a Minimal API written in C#?

Azure Key Vault
Azure Key Vault

An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.

0 comments No comments

1 answer

Sort by: Newest
  1. CuongDoHung 85 Reputation points
    2026-11-24T10:54:49.4+00:00

    Short answer: no code change. The permission model is a property of the vault, not of the client. Your Minimal API keeps the same vault URL, the same SecretClient / DefaultAzureCredential (or whatever credential it uses today) and the same GetSecretAsync calls. What changes is where the "allowed to read secrets" decision is stored: today it is an access policy on the vault, afterwards it is an Azure role assignment on the vault (or on a single secret).

    What you actually have to do, in order:

    1. Inventory who uses the vault. Azure portal > your vault > Access policies: note every identity listed (your API's managed identity or app registration, plus any humans/pipelines).
    2. Create the equivalent role assignments before switching. For a read-only app the mapping is: access policy Secret Get/List -> built-in role Key Vault Secrets User, scoped to the vault:
    az role assignment create --role "Key Vault Secrets User" --assignee-object-id <objectId of the API's identity> --assignee-principal-type ServicePrincipal --scope /subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.KeyVault/vaults/<vault>
    

    Give yourself Key Vault Administrator (or Secrets Officer) on the vault so you can still manage it afterwards; humans who had full access policies lose that at the switch otherwise. 3. Switch the model. Vault > Access configuration > Permission model = Azure role-based access control > Apply (or az keyvault update --name <vault> --enable-rbac-authorization true). The old access policies stay stored but are ignored from that moment. 4. Test the API once. Role assignments can take a few minutes to propagate, so a 403 in the first minutes after the switch is usually propagation; add retry rather than rolling back.

    Two gotchas worth knowing:

    • If the vault is ever soft-deleted and recovered, role assignments are not preserved (access policies were). Keep the role assignment in your IaC/scripts so you can re-create it.
    • Starting with Key Vault API version 2026-02-01, Azure RBAC is the default for new vaults, so this is the direction everything is going; existing vaults are not switched for you.

    Sources:

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.