azureblog.co.uk
← cd ~/roles
// roles/azure · security

Key Vault ContributorAzure built-in role

Lets you manage key vaults, but not access to them.

Role IDf25e0fa2-a7c8-4377-a976-54943a77a395
CategorySecurity
Actions6 (minus 3 NotActions)
Data actions0

What it can do

PermissionWhat it allows
Microsoft.Authorization/*/readAny read operation on anything under Microsoft.Authorization
Microsoft.Insights/alertRules/*Every operation under Microsoft.Insights/alertRules
Microsoft.KeyVault/*Every operation under Microsoft.KeyVault
Microsoft.Resources/deployments/*Every operation under Microsoft.Resources/deployments
Microsoft.Resources/subscriptions/resourceGroups/readGets or lists resource groups.
Microsoft.Support/*Every operation under Microsoft.Support

Can't do

These are taken away from the actions above.

PermissionWhat it allows
Microsoft.KeyVault/locations/deletedVaults/purge/actionPurge a soft deleted key vault
Microsoft.KeyVault/hsmPools/*Every operation under Microsoft.KeyVault/hsmPools
Microsoft.KeyVault/managedHsms/*Every operation under Microsoft.KeyVault/managedHsms

Assign it

Scope it as tightly as you can: a resource or resource group rather than the whole subscription.

azure cli
az role assignment create \
  --assignee "jane.doe@contoso.com" \
  --role "Key Vault Contributor" \
  --scope "/subscriptions/<subscription id>/resourceGroups/<resource group>"
powershell3 lines
New-AzRoleAssignment -SignInName "jane.doe@contoso.com" `
  -RoleDefinitionName "Key Vault Contributor" `
  -Scope "/subscriptions/<subscription id>/resourceGroups/<resource group>"
bicep7 lines
resource assignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
  name: guid(resourceGroup().id, principalId, 'f25e0fa2-a7c8-4377-a976-54943a77a395')
  properties: {
    roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'f25e0fa2-a7c8-4377-a976-54943a77a395')
    principalId: principalId
  }
}

Who already has it?

kql · azure resource graph
authorizationresources
| where type == "microsoft.authorization/roleassignments"
| where tostring(properties.roleDefinitionId) endswith "f25e0fa2-a7c8-4377-a976-54943a77a395"
| project principalId = tostring(properties.principalId), principalType = tostring(properties.principalType), scope = tostring(properties.scope)

Other security roles

Find the smallest role for a task →