← cd ~/roles
// roles/azure · containers
Azure Kubernetes Service RBAC WriterAzure built-in role
Allows read/write access to most objects in a namespace.This role does not allow viewing or modifying roles or role bindings. However, this role allows accessing Secrets and running Pods as any ServiceAccount in the namespace, so it can be used to gain the API access levels of any ServiceAccount in the namespace. Applying this role at cluster scope will give access across all namespaces.
| Role ID | a7ffa36f-339b-4b5c-8bdf-e2c188b2c0eb |
|---|---|
| Category | Containers |
| Actions | 4 |
| Data actions | 35 |
Before you assign it
- It reaches the data, not just the resource. It has 35 data actions, such as reading blobs, secrets or messages.
What it can do
| Permission | What it allows |
|---|---|
Microsoft.Authorization/*/read | Any read operation on anything under Microsoft.Authorization |
Microsoft.Resources/subscriptions/operationresults/read | Get the subscription operation results. |
Microsoft.Resources/subscriptions/read | Gets the list of subscriptions. |
Microsoft.Resources/subscriptions/resourceGroups/read | Gets or lists resource groups. |
Data actions
| Permission | What it allows |
|---|---|
Microsoft.ContainerService/managedClusters/apps/controllerrevisions/read | Reads controllerrevisions |
Microsoft.ContainerService/managedClusters/apps/daemonsets/* | Every operation under Microsoft.ContainerService/managedClusters/apps/daemonsets |
Microsoft.ContainerService/managedClusters/apps/deployments/* | Every operation under Microsoft.ContainerService/managedClusters/apps/deployments |
Microsoft.ContainerService/managedClusters/apps/replicasets/* | Every operation under Microsoft.ContainerService/managedClusters/apps/replicasets |
Microsoft.ContainerService/managedClusters/apps/statefulsets/* | Every operation under Microsoft.ContainerService/managedClusters/apps/statefulsets |
Microsoft.ContainerService/managedClusters/autoscaling/horizontalpodautoscalers/* | Every operation under Microsoft.ContainerService/managedClusters/autoscaling/horizontalpodautoscalers |
Microsoft.ContainerService/managedClusters/batch/cronjobs/* | Every operation under Microsoft.ContainerService/managedClusters/batch/cronjobs |
Microsoft.ContainerService/managedClusters/coordination.k8s.io/leases/read | Reads leases |
Microsoft.ContainerService/managedClusters/coordination.k8s.io/leases/write | Writes leases |
Microsoft.ContainerService/managedClusters/coordination.k8s.io/leases/delete | Deletes leases |
Microsoft.ContainerService/managedClusters/discovery.k8s.io/endpointslices/read | Reads endpointslices |
Microsoft.ContainerService/managedClusters/batch/jobs/* | Every operation under Microsoft.ContainerService/managedClusters/batch/jobs |
Microsoft.ContainerService/managedClusters/configmaps/* | Every operation under Microsoft.ContainerService/managedClusters/configmaps |
Microsoft.ContainerService/managedClusters/endpoints/* | Every operation under Microsoft.ContainerService/managedClusters/endpoints |
Microsoft.ContainerService/managedClusters/events.k8s.io/events/read | Reads events |
Microsoft.ContainerService/managedClusters/events/* | Every operation under Microsoft.ContainerService/managedClusters/events |
Microsoft.ContainerService/managedClusters/extensions/daemonsets/* | Every operation under Microsoft.ContainerService/managedClusters/extensions/daemonsets |
Microsoft.ContainerService/managedClusters/extensions/deployments/* | Every operation under Microsoft.ContainerService/managedClusters/extensions/deployments |
Microsoft.ContainerService/managedClusters/extensions/ingresses/* | Every operation under Microsoft.ContainerService/managedClusters/extensions/ingresses |
Microsoft.ContainerService/managedClusters/extensions/networkpolicies/* | Every operation under Microsoft.ContainerService/managedClusters/extensions/networkpolicies |
Microsoft.ContainerService/managedClusters/extensions/replicasets/* | Every operation under Microsoft.ContainerService/managedClusters/extensions/replicasets |
Microsoft.ContainerService/managedClusters/limitranges/read | Reads limitranges |
Microsoft.ContainerService/managedClusters/metrics.k8s.io/pods/read | Reads pods |
Microsoft.ContainerService/managedClusters/metrics.k8s.io/nodes/read | Reads nodes |
Microsoft.ContainerService/managedClusters/namespaces/read | Reads namespaces |
Microsoft.ContainerService/managedClusters/networking.k8s.io/ingresses/* | Every operation under Microsoft.ContainerService/managedClusters/networking.k8s.io/ingresses |
Microsoft.ContainerService/managedClusters/networking.k8s.io/networkpolicies/* | Every operation under Microsoft.ContainerService/managedClusters/networking.k8s.io/networkpolicies |
Microsoft.ContainerService/managedClusters/persistentvolumeclaims/* | Every operation under Microsoft.ContainerService/managedClusters/persistentvolumeclaims |
Microsoft.ContainerService/managedClusters/pods/* | Every operation under Microsoft.ContainerService/managedClusters/pods |
Microsoft.ContainerService/managedClusters/policy/poddisruptionbudgets/* | Every operation under Microsoft.ContainerService/managedClusters/policy/poddisruptionbudgets |
Microsoft.ContainerService/managedClusters/replicationcontrollers/* | Every operation under Microsoft.ContainerService/managedClusters/replicationcontrollers |
Microsoft.ContainerService/managedClusters/resourcequotas/read | Reads resourcequotas |
Microsoft.ContainerService/managedClusters/secrets/* | Every operation under Microsoft.ContainerService/managedClusters/secrets |
Microsoft.ContainerService/managedClusters/serviceaccounts/* | Every operation under Microsoft.ContainerService/managedClusters/serviceaccounts |
Microsoft.ContainerService/managedClusters/services/* | Every operation under Microsoft.ContainerService/managedClusters/services |
Assign it
Scope it as tightly as you can: a resource or resource group rather than the whole subscription.
az role assignment create \
--assignee "jane.doe@contoso.com" \
--role "Azure Kubernetes Service RBAC Writer" \
--scope "/subscriptions/<subscription id>/resourceGroups/<resource group>"New-AzRoleAssignment -SignInName "jane.doe@contoso.com" `
-RoleDefinitionName "Azure Kubernetes Service RBAC Writer" `
-Scope "/subscriptions/<subscription id>/resourceGroups/<resource group>"resource assignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
name: guid(resourceGroup().id, principalId, 'a7ffa36f-339b-4b5c-8bdf-e2c188b2c0eb')
properties: {
roleDefinitionId: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'a7ffa36f-339b-4b5c-8bdf-e2c188b2c0eb')
principalId: principalId
}
}Who already has it?
authorizationresources
| where type == "microsoft.authorization/roleassignments"
| where tostring(properties.roleDefinitionId) endswith "a7ffa36f-339b-4b5c-8bdf-e2c188b2c0eb"
| project principalId = tostring(properties.principalId), principalType = tostring(properties.principalType), scope = tostring(properties.scope)Other containers roles
- AcrDelete · 1 permission
- AcrPull · 1 permission
- Connected Cluster Managed Identity CheckAccess Reader · 1 permission
- Container Registry Cache Rule Reader · 1 permission
- Container Registry Credential Set Reader · 1 permission
- Container Registry Repository Catalog Lister · 1 permission
- AcrImageSigner · 2 permissions
- AcrPush · 2 permissions