How it works
Azure Key Vault stores secrets, keys and certificates that applications fetch at run time: database passwords, service principal secrets, storage account keys, TLS certificates. Whoever can read the vault's data holds the credentials of every system that depends on it, which makes a vault a shortcut around every other control.
Access to a vault runs through two planes that are authorized separately:
- The control plane is Azure Resource Manager. It creates and deletes vaults, changes their properties and, for vaults that use them, writes access policies. It is authorized with Azure role-based access control.
- The data plane is the vault's own endpoint (
https://<vault>.vault.azure.net). It reads, writes and deletes secrets, keys and certificates. It is authorized by one of two permission models, chosen per vault.
The two models decide who can grant data access:
- Access policy model (legacy). The vault holds a list of entries, each naming a principal and the secret, key and certificate operations it may perform. The list is a property of the vault, so writing it is a control-plane operation:
Microsoft.KeyVault/vaults/write, or the narrowerMicrosoft.KeyVault/vaults/accessPolicies/write. Any principal with either permission can add an entry for itself. Contributor and Key Vault Contributor carryvaults/write, so on such a vault a management role is one command away from every secret. - Azure RBAC model. Data access comes only from a role assignment whose role has the right data actions, such as Key Vault Secrets User or Key Vault Administrator. Creating the assignment needs
Microsoft.Authorization/roleAssignments/write, which Contributor does not have. A management write on the vault does not reach the data.
That gives three variants:
- Direct read. The attacker controls an identity that already has data access: an administrator, or more often an application's service principal or managed identity.
- Self-grant on an access-policy vault. A management role adds an access policy entry for the attacker and then reads.
- Self-grant on an RBAC vault. An identity with
roleAssignments/writeassigns itself a Key Vault data role at the vault, the resource group or the subscription. This is role assignment abuse aimed at a vault.
A fourth move changes the model itself: the vault's enableRbacAuthorization property selects which model applies, and switching an RBAC vault back to access policies puts the first self-grant in reach again. Treat a change to that property, in either direction, as an access change.
A network restriction on the vault can still block a caller that has the permission, and listing secret names is a different operation from reading a secret's value.
Prerequisites
- A credential for an identity in the vault's tenant.
- One of:
- an access policy entry or a Key Vault data role that allows
get(and usuallylist) on secrets; Microsoft.KeyVault/vaults/writeorMicrosoft.KeyVault/vaults/accessPolicies/writeon a vault that uses access policies;Microsoft.Authorization/roleAssignments/writeat a scope that covers a vault that uses Azure RBAC.
- an access policy entry or a Key Vault data role that allows
- Network access to the vault's data endpoint. A vault with a firewall or private endpoint accepts data requests only from allowed networks.
Attack steps
For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.
The steps below are for an authorized assessment or a lab.
1. Find the vaults and their permission model
az keyvault list --query "[].{name:name, rg:resourceGroup}" --output table
# Which model the vault uses, and who is on the access policy list
az keyvault show --name kv-prod \
--query "{rbac:properties.enableRbacAuthorization, policies:properties.accessPolicies[].objectId, network:properties.networkAcls.defaultAction}"
# Role assignments that apply to the vault, including inherited ones
az role assignment list --include-inherited \
--scope "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-prod/providers/Microsoft.KeyVault/vaults/kv-prod" --output table
Reading the vault's properties needs only a management read. No data-plane request is made yet.
2. Self-grant on an access-policy vault
# Object ID of the signed-in user
az ad signed-in-user show --query id --output tsv
# Add an access policy entry for that object
az keyvault set-policy -n kv-prod --secret-permissions get list \
--object-id 00000000-0000-0000-0000-000000000000
PowerShell does the same:
Set-AzKeyVaultAccessPolicy -VaultName 'kv-prod' -ObjectId 00000000-0000-0000-0000-000000000000 -PermissionsToSecrets Get,List
3. Self-grant on an RBAC vault
az role assignment create --role "Key Vault Secrets User" \
--assignee "alice@corp.example.com" \
--scope "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-prod/providers/Microsoft.KeyVault/vaults/kv-prod"
Key Vault Secrets User reads secret values. Key Vault Administrator covers secrets, keys and certificates.
4. Variant: switch the vault back to access policies
az keyvault update --name kv-prod --resource-group rg-prod --enable-rbac-authorization false
After the switch, role assignments no longer govern the data plane and the access policy list does, so step 2 applies.
5. Read the secrets
# Names and metadata
az keyvault secret list --vault-name kv-prod --query "[].name" --output tsv
# One value
az keyvault secret show --vault-name kv-prod --name db-password --query value --output tsv
# Every current value
for name in $(az keyvault secret list --vault-name kv-prod --query "[].name" --output tsv); do
echo "$name: $(az keyvault secret show --vault-name kv-prod --name "$name" --query value --output tsv)"
done
With a token taken from a workload instead of an interactive sign-in, the REST API works the same way. The token's audience must be https://vault.azure.net:
curl -s -H "Authorization: Bearer $TOKEN" \
"https://kv-prod.vault.azure.net/secrets/db-password?api-version=2025-07-01"
6. Use what the vault held
The values are credentials for other systems. Service principal secrets go to az login --service-principal, storage keys sign SAS tokens, database passwords open the databases.
Impact
Every credential in the vault is exposed at once, and each one is a way into another system with that system's privileges. This is credential theft at the point where the organization chose to concentrate its secrets. Keys can be used to decrypt or sign, and certificates with exportable private keys can be taken out and used for authentication elsewhere.
The secrets stay valid after the attacker's vault access is removed. Recovery means rotating everything the identity could read, not just closing the grant.
OPSEC and artifacts
- Using an identity that already reads the vault. An application's own identity reading its own secrets is what the vault sees all day. Operators who control such an identity read through it, from the workload's network. The reads are still logged, one
SecretGetper secret, and the count and the set of secret names can differ from the application's pattern. - Reading a few named secrets instead of everything. Listing and then reading every secret produces
SecretListfollowed by a burst ofSecretGetfrom one caller, which is what bulk-read rules look for. A careful operator reads only the secrets worth having and spaces the requests. - Self-grant leaves a control-plane record. Adding an access policy entry writes
Microsoft.KeyVault/vaults/accessPolicies/write(orvaults/write) in the Activity Log with the caller, and the vault's audit log records the change asVaultPatchorVaultPut, plus aVaultAccessPolicyChangedEventGridNotificationentry that is logged whether or not an Event Grid subscription exists. The resulting policy list shows the new object ID until someone removes it. Operators remove the entry after reading, which adds a second write record. - RBAC self-grant leaves a role assignment record.
Microsoft.Authorization/roleAssignments/writeat the vault or above, with the role and scope. When the vault authorizes a request through RBAC, the audit log marks it (IsRbacAuthorized) and can name the assignment that allowed it (AppliedAssignmentId). - Model switch is a property change. A change to
enableRbacAuthorizationis avaults/writerecord. It also changes who has access for every other user of the vault, which tends to break applications and get noticed. - Nothing records what happens to the value. A successful
SecretGetshows that the vault delivered the secret. Copying it elsewhere leaves no trace in Azure; only the later use of the credential does. - Audit logs exist only if routed. Vault data operations reach
AZKVAuditLogsonly when a diagnostic setting sends the audit category to a workspace in resource-specific mode. In legacy mode the same events land inAzureDiagnosticswith different columns. Without a diagnostic setting there is no data-plane record at all.
Detection
- Bulk reads. One caller reading many secrets, keys or certificates in a short window. The Key Vault bulk read rules implement this on the SecretGet record. Backup operations export the protected object too: see SecretBackup.
- Access changes. The access policy changed or data role granted rules cover both self-grant variants. The records are vaults/accessPolicies/write and vaults/write in the Activity Log, and VaultPatch, VaultPut and the access policy changed notification in the vault's own log. For the RBAC variant, the privileged role assignment rules apply.
- Grant, read, revoke. An access change by a caller, reads by the same caller minutes later, and removal of the grant is the strongest pattern. It needs the Activity Log and the vault log side by side.
- New caller or new address. A principal or source address that has not read this vault before. For application identities, compare
CallerIpAddresswith the workload's addresses. - Recovered objects. Recovering a soft-deleted vault or secret brings old credentials back into reach: see the soft-deleted vault or secret recovered rules.
// Callers that read many distinct secrets from one vault in 10 minutes
AZKVAuditLogs
| where OperationName =~ "SecretGet" and HttpStatusCode == 200
| extend SecretPath = tostring(split(RequestUri, "?")[0])
| summarize Secrets = dcount(SecretPath), Requests = count()
by _ResourceId, CallerIpAddress, tostring(Identity), bin(TimeGenerated, 10m)
| where Secrets >= 10
| order by Secrets desc
The threshold is a starting value: deployment pipelines and some applications read many secrets at start-up, so baseline per vault. A forbidden result (403) is also worth keeping. It shows an identity that tried and was refused.
Mitigation
- Move vaults to the Azure RBAC permission model. It takes data access out of the hands of management roles and puts it behind role assignments. Microsoft recommends it over access policies for this reason.
- Until then, restrict
vaults/write. On an access-policy vault, Contributor, Key Vault Contributor and any custom role withMicrosoft.KeyVault/vaults/writeorvaults/accessPolicies/writeare data readers in waiting. Limit them at the vault, resource group and subscription. - Restrict who can create role assignments over vault scopes, and who can change
enableRbacAuthorization. Review both with the data owners, not only the platform team. - One vault per application and environment, with data roles assigned at the vault to the identity that needs them and nobody else. This follows least privilege and keeps one compromised identity from reading unrelated secrets.
- Close the network path. Use the vault firewall or private endpoints so that a stolen token or a self-granted user can't read from the internet.
- Turn on audit logging for every vault with a diagnostic setting to a central workspace, in resource-specific mode, and keep the logs outside the reach of the roles that manage the vault.
- Prefer identities over stored secrets. Where a service supports managed identity or workload federation, there is no secret to keep in a vault and nothing to read.
- Rotate after exposure. If an identity that should not have had access read a secret, rotate that secret at its source. Removing the grant does not make the copied value stop working.
Detection rules for this attack
Log events to collect
FAQ
Can a Contributor read Key Vault secrets?
Not directly, but on a vault that uses the access policy model it can grant itself the right. Microsoft warns that users with Contributor, Key Vault Contributor or any role that includes Microsoft.KeyVault/vaults/write can give themselves data plane access by setting an access policy. On a vault that uses Azure RBAC, a management write alone does not reach the data.
What is the difference between the access policy model and the RBAC model?
Access policies are a legacy authorization system inside the vault: a list of principals and the operations each may perform, written with a management operation on the vault. The RBAC model uses Azure role assignments with data actions, so only identities that can create role assignments, such as Owner and User Access Administrator, can grant data access.
How do you detect someone reading Key Vault secrets?
Enable the vault's audit logs and send them to a workspace. Each read is a SecretGet operation with the caller's identity, address and result. Alert on a caller reading many secrets in a short time, on a new caller for a vault, and on an access policy or permission model change shortly before the reads.
References
- Credentials from Password Stores: Cloud Secrets Management Stores, T1555.006 (MITRE ATT&CK)
- Provide access to Key Vault keys, certificates, and secrets with Azure role-based access control (Microsoft Learn)
- Azure RBAC vs. access policies (legacy) (Microsoft Learn)
- Assign a Key Vault access policy (legacy) (Microsoft Learn)
- Azure Key Vault logging (Microsoft Learn)
- AZKVAuditLogs table reference (Azure Monitor)
- az keyvault (Azure CLI reference)
Techniques, tactics and threat groups: MITRE ATT&CK® Enterprise v20.1. © The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. Last updated 2026-11-29.