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

Cosmos DB Account Reader RoleAzure built-in role

Can read Azure Cosmos DB Accounts data

Role IDfbdf93bf-df7d-467e-a4d2-9458aa1360c8
CategoryDatabases
Actions7
Data actions0

What it can do

PermissionWhat it allows
Microsoft.Authorization/*/readAny read operation on anything under Microsoft.Authorization
Microsoft.DocumentDB/*/readAny read operation on anything under Microsoft.DocumentDB
Microsoft.DocumentDB/databaseAccounts/readonlykeys/actionReads the database account readonly keys.
Microsoft.Insights/MetricDefinitions/readRead metric definitions
Microsoft.Insights/Metrics/readRead metrics
Microsoft.Resources/subscriptions/resourceGroups/readGets or lists resource groups.
Microsoft.Support/*Every operation under Microsoft.Support

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 "Cosmos DB Account Reader Role" \
  --scope "/subscriptions/<subscription id>/resourceGroups/<resource group>"
powershell3 lines
New-AzRoleAssignment -SignInName "jane.doe@contoso.com" `
  -RoleDefinitionName "Cosmos DB Account Reader Role" `
  -Scope "/subscriptions/<subscription id>/resourceGroups/<resource group>"
bicep7 lines
resource assignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
  name: guid(resourceGroup().id, principalId, 'fbdf93bf-df7d-467e-a4d2-9458aa1360c8')
  properties: {
    roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'fbdf93bf-df7d-467e-a4d2-9458aa1360c8')
    principalId: principalId
  }
}

Who already has it?

kql · azure resource graph
authorizationresources
| where type == "microsoft.authorization/roleassignments"
| where tostring(properties.roleDefinitionId) endswith "fbdf93bf-df7d-467e-a4d2-9458aa1360c8"
| project principalId = tostring(properties.principalId), principalType = tostring(properties.principalType), scope = tostring(properties.scope)

Other databases roles

Find the smallest role for a task →