Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Note
Azure ABAC for Key Vault is in preview. Some aspects might change before general availability. For preview terms, see the supplemental terms of use.
This article describes the supported actions, attributes, and operators that you can use in conditions on Azure role assignments for Azure Key Vault. For an overview of how role assignment conditions work, see What is Azure attribute-based access control (Azure ABAC)?. For the list of Key Vault data actions that a specific permission affects, see the Azure RBAC for Key Vault data plane operations guide.
Overview
Azure ABAC for Key Vault builds on Azure RBAC by adding conditions to role assignments. Azure evaluates each condition at runtime against the attributes of the resource being accessed or the incoming request, and either allows or denies the request based on comparison operators.
The benefits of using role assignment conditions for Key Vault are:
- Finer-grained access to secrets. Restrict a principal to secrets whose names match a specific pattern (for example,
app-*orteam-prod-*), or to specific key vaults by vault name. - Fewer role assignments to manage. Use a single condition-gated role assignment for a security group instead of many individual assignments that model the same permissions. ABAC helps you scale role management - it doesn't grant permissions that a role assignment doesn't already grant.
- Extends existing Azure RBAC. ABAC layers on top of your existing role assignments. You don't have to replace RBAC to use it.
In this preview, ABAC for Key Vault applies only to secret data actions and supports two attributes: the vault name and the secret name. Key data actions, certificate data actions, tag-based attributes, token attributes, and built-in Key Vault ABAC conditions on any role aren't included.
To use ABAC conditions, the key vault's permission model must be set to Azure RBAC. For background, see Azure RBAC vs. access policies and Prepare for Key Vault API version 2026-02-01 and later.
Condition format
Conditions use the following general format:
@Resource[<ResourceType>:<AttributeName>] <Operator> '<Value>'
| Component | Description |
|---|---|
@Resource |
Refers to an attribute of the resource being accessed. Use @Request when the attribute describes the incoming request (for example, the name of a secret that doesn't yet exist). |
ResourceType |
The Azure Resource Manager resource type. For Key Vault in this preview, either Microsoft.KeyVault/vaults or Microsoft.KeyVault/vaults/secrets. |
AttributeName |
The specific attribute to evaluate. In this preview, name is the only supported attribute. |
Operator |
The comparison operator. See Supported operators. |
Value |
The literal value to compare against. |
The condition version must be set to 2.0. For the complete grammar, see Azure role assignment condition format and syntax.
Supported operators
Azure Key Vault ABAC conditions support all the string comparison operators defined in the Azure ABAC condition format. For the full list of operators and their behavior, see String comparison operators.
Note
Azure ABAC string comparison operators include case-sensitive variants, but Key Vault vault names and object names are case-insensitive and are normalized to lowercase. As a result, case-sensitive matching doesn't apply to Key Vault ABAC conditions. Use lowercase values in your conditions - a value containing uppercase characters won't match any vault or secret name.
Azure Key Vault actions
You can apply ABAC conditions to the following Key Vault secret data actions. Each subsection describes the action, the underlying DataAction, the attribute source it evaluates (Resource or Request), and an example condition.
Get secret
| Property | Value |
|---|---|
| Display name | Get secret |
| Description | Gets the value of a secret. |
| DataAction | Microsoft.KeyVault/vaults/secrets/getSecret/action |
| Resource attributes | Secret name |
| Example | !(ActionMatches{'Microsoft.KeyVault/vaults/secrets/getSecret/action'}) OR @Resource[Microsoft.KeyVault/vaults/secrets:name] StringStartsWith 'test-app' |
Read secret metadata
| Property | Value |
|---|---|
| Display name | Read secret metadata |
| Description | Lists or views the properties of a secret, but not its value. |
| DataAction | Microsoft.KeyVault/vaults/secrets/readMetadata/action |
| Resource attributes | Secret name |
| Example | !(ActionMatches{'Microsoft.KeyVault/vaults/secrets/readMetadata/action'}) OR @Resource[Microsoft.KeyVault/vaults/secrets:name] StringStartsWith 'api-' |
Warning
The readMetadata/action covers both retrieving a single secret's properties (which carries a secret name) and listing secrets in a vault (a collection call with no per-secret name). ABAC evaluates a condition per action, not row-by-row against list results, so a secret-name condition on readMetadata/action fails the list call with a 403 error - the name attribute isn't present on the collection request and can't match. This behavior surfaces in the portal Secrets blade as a blank list.
If you want a principal to see every secret name in the list but only open the values that match a pattern, don't gate readMetadata/action. Instead, grant readMetadata/action unconditionally and apply the secret-name condition to getSecret/action. See the Restrict read access to secrets with a name prefix example.
Set secret
| Property | Value |
|---|---|
| Display name | Set secret |
| Description | Sets the value of a secret. If the secret doesn't exist, the first version is created. Otherwise, a new version is created with the specified value. |
| DataAction | Microsoft.KeyVault/vaults/secrets/setSecret/action |
| Request attributes | Secret name |
| Example | !(ActionMatches{'Microsoft.KeyVault/vaults/secrets/setSecret/action'}) OR @Request[Microsoft.KeyVault/vaults/secrets:name] StringStartsWith 'app-' |
Update secret
| Property | Value |
|---|---|
| Display name | Update secret |
| Description | Updates the attributes associated with the given secret. |
| DataAction | Microsoft.KeyVault/vaults/secrets/update/action |
| Resource attributes | Secret name |
| Example | !(ActionMatches{'Microsoft.KeyVault/vaults/secrets/update/action'}) OR @Resource[Microsoft.KeyVault/vaults/secrets:name] StringStartsWith 'app-' |
Delete secret
| Property | Value |
|---|---|
| Display name | Delete secret |
| Description | Deletes a secret. All versions are deleted. |
| DataAction | Microsoft.KeyVault/vaults/secrets/delete |
| Resource attributes | Secret name |
| Example | !(ActionMatches{'Microsoft.KeyVault/vaults/secrets/delete'}) OR @Resource[Microsoft.KeyVault/vaults/secrets:name] StringStartsWith 'temp-' |
Backup secret
| Property | Value |
|---|---|
| Display name | Backup secret |
| Description | Creates the backup file of a secret. The file can be used to restore the secret in a key vault of the same subscription. Restrictions might apply. |
| DataAction | Microsoft.KeyVault/vaults/secrets/backup/action |
| Resource attributes | Secret name |
| Example | !(ActionMatches{'Microsoft.KeyVault/vaults/secrets/backup/action'}) OR @Resource[Microsoft.KeyVault/vaults/secrets:name] StringStartsWith 'critical-' |
Restore secret
| Property | Value |
|---|---|
| Display name | Restore secret |
| Description | Restores a secret and all its versions from a backup file generated by Key Vault. |
| DataAction | Microsoft.KeyVault/vaults/secrets/restore/action |
| Request attributes | Secret name |
| Example | !(ActionMatches{'Microsoft.KeyVault/vaults/secrets/restore/action'}) OR @Request[Microsoft.KeyVault/vaults/secrets:name] StringStartsWith 'app-' |
Recover secret
| Property | Value |
|---|---|
| Display name | Recover secret |
| Description | Recovers a deleted secret. The operation performs the reversal of the Delete operation and is applicable in vaults enabled for soft-delete. |
| DataAction | Microsoft.KeyVault/vaults/secrets/recover/action |
| Resource attributes | Secret name |
| Example | !(ActionMatches{'Microsoft.KeyVault/vaults/secrets/recover/action'}) OR @Resource[Microsoft.KeyVault/vaults/secrets:name] StringStartsWith 'app-' |
Purge secret
| Property | Value |
|---|---|
| Display name | Purge secret |
| Description | Purges a deleted secret, making it unrecoverable. |
| DataAction | Microsoft.KeyVault/vaults/secrets/purge/action |
| Resource attributes | Secret name |
| Example | !(ActionMatches{'Microsoft.KeyVault/vaults/secrets/purge/action'}) OR @Resource[Microsoft.KeyVault/vaults/secrets:name] StringStartsWith 'old-' |
Attribute sources
Attributes describe properties evaluated at request time. Resource attributes describe the resource being accessed. Request attributes describe the incoming request when the resource might not yet exist (for example, during setSecret or restore).
Vault name
Use this attribute to scope access to key vaults whose names match a given pattern. When you apply a condition at subscription or resource group scope, Azure evaluates the vault name for every vault the principal attempts to access.
| Property | Value |
|---|---|
| Display name | Vault name |
| Description | The name of the key vault being accessed. |
| Attribute | Microsoft.KeyVault/vaults:name |
| Attribute source | Resource |
| Attribute type | String |
| Applicable actions | All Key Vault secret data actions (global attribute) |
Example conditions:
@Resource[Microsoft.KeyVault/vaults:name] StringStartsWith 'prod-'
@Resource[Microsoft.KeyVault/vaults:name] StringEquals 'sample-vault'
@Resource[Microsoft.KeyVault/vaults:name] StringLike 'team-*-prod'
Secret name (Resource)
Use this attribute when the secret already exists at evaluation time.
| Property | Value |
|---|---|
| Display name | Secret name |
| Description | The name of the secret being accessed. |
| Attribute | Microsoft.KeyVault/vaults/secrets:name |
| Attribute source | Resource |
| Attribute type | String |
| Applicable actions | getSecret/action, readMetadata/action, update/action, delete, backup/action, recover/action, purge/action |
Example conditions:
@Resource[Microsoft.KeyVault/vaults/secrets:name] StringStartsWith 'test-app'
@Resource[Microsoft.KeyVault/vaults/secrets:name] StringLike 'api-key-*'
Secret name (Request)
Use this attribute when the secret might not yet exist at evaluation time, such as during creation or restore.
| Property | Value |
|---|---|
| Display name | Secret name (Request) |
| Description | The name of a secret being requested. |
| Attribute | Microsoft.KeyVault/vaults/secrets:name |
| Attribute source | Request |
| Attribute type | String |
| Applicable actions | setSecret/action, restore/action |
Example conditions:
@Request[Microsoft.KeyVault/vaults/secrets:name] StringStartsWith 'app-'
@Request[Microsoft.KeyVault/vaults/secrets:name] StringLike 'config-*'
Roles that support ABAC conditions
You can apply ABAC conditions to any role that includes Key Vault secret dataActions. Roles that only contain control-plane actions (such as Owner or Policy Administrator) don't support ABAC conditions because Azure evaluates conditions exclusively on data-plane operations. In this preview, no built-in role includes a preassigned Key Vault ABAC condition - you author the condition when you create the role assignment.
The following built-in roles include secret data actions and support ABAC conditions in this preview. For the full role definitions and IDs, see Azure built-in roles for Key Vault data plane operations.
| Role | Description | ID | Condition support |
|---|---|---|---|
| Key Vault Administrator | Perform all data plane operations on a key vault and all objects in it. | 00482a5a-887f-4fb3-b363-3b7fe8e74483 |
Resource and Request attributes on secret operations |
| Key Vault Secrets Officer | Perform any action on secrets. | b86a8fe4-44ce-4948-aee5-eccb2c155cd7 |
Resource attributes on read and lifecycle operations; Request attributes on setSecret and restore operations |
| Key Vault Secrets User | Read secret contents. | 4633458b-17de-408a-b874-0445c86b69e6 |
Resource attributes on secret read operations |
| Key Vault Reader | Read metadata of vaults and their objects. | 21090545-7ca7-4776-b22c-e363652d74d2 |
Resource attributes on readMetadata/action for a single secret. A secret-name condition here blocks list calls; see the warning under Read secret metadata. |
| Key Vault Certificate User | Read certificate contents. | db79e9a7-68ee-4b58-9aeb-b90e7c24fcba |
Resource attributes on getSecret and readMetadata (certificates are retrieved through the secret endpoint - the secret name equals the certificate name) |
| Custom roles | Any custom role definition that includes secret dataActions for Key Vault. |
- | Depends on which secret dataActions are included |
Note
Only roles assigned through Azure RBAC (not legacy vault access policies) support ABAC conditions. The key vault must have its permission model set to Azure role-based access control. Starting with API version 2026-02-01, Azure RBAC is the default for newly created vaults. For more information, see Prepare for Key Vault API version 2026-02-01 and later.
Condition examples
The following examples show common ABAC patterns for Key Vault secrets. For more on the condition syntax, see Azure role assignment condition format and syntax.
Example: Restrict read access to secrets with a name prefix
Allow a principal to read only secrets whose names start with test-app:
- Role: Key Vault Secrets User
- Scope: Key vault resource
- Condition:
(
!(ActionMatches{'Microsoft.KeyVault/vaults/secrets/getSecret/action'})
OR
(
@Resource[Microsoft.KeyVault/vaults/secrets:name] StringStartsWith 'test-app'
)
)
Behavior:
- Allowed: Reading
test-app-secret1. - Denied (
ForbiddenByRbac): Readingtest-db-password.
Example: Restrict access to secrets in specific vaults by vault name prefix
Allow a principal to read secrets only in vaults whose names start with kv-prod:
- Role: Key Vault Secrets User
- Scope: Subscription
- Condition:
@Resource[Microsoft.KeyVault/vaults:name] StringStartsWith 'kv-prod'
Behavior:
- Allowed: Access to
kv-prod-1. - Denied: Access to
test-kv.
Example: Restrict newly created secrets to a name prefix
Allow a principal to create secrets only when the secret name starts with app-. Because the secret doesn't yet exist at evaluation time, use the Request attribute:
- Role: Key Vault Secrets Officer
- Scope: Key vault resource
- Condition:
(
!(ActionMatches{'Microsoft.KeyVault/vaults/secrets/setSecret/action'})
OR
(
@Request[Microsoft.KeyVault/vaults/secrets:name] StringStartsWith 'app-'
)
)
Example: Combine vault and secret name conditions
Restrict a principal to read only secrets that start with api- in vaults whose names start with kv-prod:
- Role: Key Vault Secrets User
- Scope: Subscription
- Condition:
(
!(ActionMatches{'Microsoft.KeyVault/vaults/secrets/getSecret/action'})
OR
(
@Resource[Microsoft.KeyVault/vaults:name] StringStartsWith 'kv-prod'
AND
@Resource[Microsoft.KeyVault/vaults/secrets:name] StringStartsWith 'api-'
)
)
Related content
- Add role assignment conditions for Key Vault secrets by using Azure CLI (preview)
- Add role assignment conditions for Key Vault secrets by using Azure PowerShell (preview)
- What is Azure attribute-based access control (Azure ABAC)?
- Azure role assignment condition format and syntax
- Provide access to Key Vault keys, certificates, and secrets with Azure RBAC
- Troubleshoot Azure role assignment conditions
- Troubleshoot Key Vault access issues
- Prepare for Key Vault API version 2026-02-01 and later