Container Registry should use customer-managed key encryption
Medium
Azure
General
acr-encryption
Applies to
Microsoft.ContainerRegistry/registries
What CGPulse checks
A resource passes this rule when encryption.status must equal enabled. Anything else is reported as a finding with the evaluated property value attached as evidence.
How to fix it
Configure customer-managed keys via Key Vault for full control over encryption key lifecycle. In Azure Portal: Container Registry > Encryption > select Customer-managed key. See: https://learn.microsoft.com/en-us/azure/container-registry/tutorial-customer-managed-keys
CLI
az acr show --ids "{id}" --query "encryption" -o jsonBicep
// CMK requires Premium SKU and a Key Vault key
param keyVaultUri string
param keyName string
resource acr 'Microsoft.ContainerRegistry/registries@2023-11-01-preview' = {{
name: '{name}'
location: resourceGroup().location
sku: {{ name: 'Premium' }}
properties: {{
encryption: {{
status: 'enabled'
keyVaultProperties: {{
keyIdentifier: '${{keyVaultUri}}/keys/${{keyName}}'
}}
}}
}}
}}Terraform
# CMK requires Premium SKU and a Key Vault key
resource "azurerm_container_registry" "{name}" {
name = "{name}"
resource_group_name = "{rg}"
location = var.location
sku = "Premium"
encryption {
key_vault_key_id = "<key-vault-key-id>"
identity_client_id = "<user-assigned-identity-client-id>"
}
}
Compliance frameworks
Is your environment compliant with this rule?
CGPulse checks it — and 621 others — against your Azure and AWS accounts with read-only access.
Related Azure rules
- Action Group should be enabled
- Activity Log Alert should be enabled
- AKS cluster logs should be sent to Log Analytics
- AKS cluster must enable RBAC
- AKS cluster must enable RBAC
- AKS cluster should be a private cluster
- AKS cluster should disable local accounts
- AKS cluster should enable Azure RBAC for Kubernetes