Azure role assignments¶
Four role assignments, two on each managed identity.
| Identity | Role | Scope |
|---|---|---|
| Runtime | AcrPush |
The registry resource ID |
| Runtime | Storage Blob Data Contributor |
The blob container |
| Build | AcrPush |
The registry resource ID |
| Build | Storage Blob Data Contributor |
The blob container |
Plus one federated identity credential per identity. See Azure workload identity.
The registry assignment¶
resource "azurerm_role_assignment" "runtime_acr_push" {
scope = "/subscriptions/.../resourceGroups/<resource-group>/providers/Microsoft.ContainerRegistry/registries/<acr-name>"
role_definition_name = "AcrPush"
principal_id = azurerm_user_assigned_identity.runtime.principal_id
}
AcrPush covers push and pull. The scope is the registry, taken from
artifact_registry_scope.
The blob assignment¶
resource "azurerm_role_assignment" "runtime_bucket_blob_data_contributor" {
scope = "/subscriptions/.../storageAccounts/<storage-account>/blobServices/default/containers/<container>"
role_definition_name = "Storage Blob Data Contributor"
principal_id = azurerm_user_assigned_identity.runtime.principal_id
}
The scope is composed from the account and container in your azblob:// path,
so the grant is confined to that container rather than the whole account.
Compared with the other clouds¶
| Azure | GCP | AWS | |
|---|---|---|---|
| Identities | 2 managed identities | 3 service accounts | 2 IAM roles |
| Registry grant | AcrPush at registry scope |
Project role, plus a repository-scoped delegate | Inline policy, Resource = "*" |
| Storage grant | Container-scoped | Bucket-wide | Prefix-scoped objects |
| Publish path | Direct on each identity | Through a delegate identity | Direct on each role |
Azure's registry grant is the most precisely scoped of the three by default, because the registry resource ID is asked for as its own field.
What is outside this baseline¶
Tenant registry and blob container access only. Private upstream registries, external storage accounts and third-party tokens are explicit add-on profiles.
Verifying after apply¶
az role assignment list \
--assignee $(az identity show -g <resource-group> -n dp-eu-west1-runtime --query principalId -o tsv) \
--all -o table
Two assignments should appear, AcrPush and Storage Blob Data Contributor,
scoped as above.