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 json

Bicep

// 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

Vendor documentation

Is your environment compliant with this rule?

CGPulse checks it — and 621 others — against your Azure and AWS accounts with read-only access.

Run a free scan

Related Azure rules

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please reload the page.