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

Data PurgerAzure built-in role

Can purge analytics data

Role ID150f5e0c-0603-4f03-8c7f-cf70034c4e90
CategoryMonitor
Actions4
Data actions0

What it can do

PermissionWhat it allows
Microsoft.Insights/components/*/readAny read operation on anything under Microsoft.Insights/components
Microsoft.Insights/components/purge/actionPurging data from Application Insights
Microsoft.OperationalInsights/workspaces/*/readAny read operation on anything under Microsoft.OperationalInsights/workspaces
Microsoft.OperationalInsights/workspaces/purge/actionDelete specified data by query from workspace.

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 "Data Purger" \
  --scope "/subscriptions/<subscription id>/resourceGroups/<resource group>"
powershell3 lines
New-AzRoleAssignment -SignInName "jane.doe@contoso.com" `
  -RoleDefinitionName "Data Purger" `
  -Scope "/subscriptions/<subscription id>/resourceGroups/<resource group>"
bicep7 lines
resource assignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
  name: guid(resourceGroup().id, principalId, '150f5e0c-0603-4f03-8c7f-cf70034c4e90')
  properties: {
    roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '150f5e0c-0603-4f03-8c7f-cf70034c4e90')
    principalId: principalId
  }
}

Who already has it?

kql · azure resource graph
authorizationresources
| where type == "microsoft.authorization/roleassignments"
| where tostring(properties.roleDefinitionId) endswith "150f5e0c-0603-4f03-8c7f-cf70034c4e90"
| project principalId = tostring(properties.principalId), principalType = tostring(properties.principalType), scope = tostring(properties.scope)

Other monitor roles

Find the smallest role for a task →