Lesson 4 of 5 Securing Container Workloads

Securing Azure Container Registry

This lesson explains access control, network isolation and image signing for Azure Container Registry.

Learning outcomes

After completing this lesson, you will be able to:

  • Explain why the registry matters.
  • Choose a registry role.
  • Describe network isolation and its side effects.
  • Explain the move from Docker Content Trust to the Notary Project.

Why the registry matters

If an attacker can push a tampered image to a registry, then every cluster that pulls it will run the attacker's code, with no need to attack the cluster directly. Azure Container Registry (ACR) needs to be protected against unauthorized pushes, pulls by the wrong parties, and exposure to the internet. Its tiers affect which security features are available: Premium is needed for private endpoints and geo-replication.

Authentication and roles

The recommended sign-in for people is az acr login with a Microsoft Entra identity, and for workloads a managed identity or service principal. The admin user is a single account with full rights and a shared password, so it should stay disabled. AKS can pull from ACR with its kubelet identity, by using az aks update --attach-acr.

The roles depend on the registry's permissions mode, shown on its Properties page.

ModeRoleAllows
RBAC Registry PermissionsAcrPullPulling images, read-only
RBAC Registry PermissionsAcrPushPushing and pulling images
RBAC Registry PermissionsAcrDeleteDeleting artifacts and tags
RBAC Registry + ABAC Repository PermissionsContainer Registry Repository ReaderReading, with ABAC conditions for each repository
RBAC Registry + ABAC Repository PermissionsContainer Registry Repository WriterWriting, with conditions
RBAC Registry + ABAC Repository PermissionsContainer Registry Repository ContributorWriting and deleting, with conditions
BothContainer Registry Contributor and Data Access Configuration AdministratorManaging the registry, including admin user and anonymous pull settings

Least privilege at the level of a repository is available through ABAC for Entra identities, or through non-Entra token-based repository permissions. A scenario in which one team must push only to its own repository points to one of these.

Scenario questions

Registry roles

Exam skills 3.3.3

Choose the registry access for each requirement.

Log in to try this activity Interactive activities are free with an account.

Network isolation

Premium registries support private endpoints, with the zone privatelink.azurecr.io. A registry has a login endpoint and a data endpoint, REGISTRY.REGION.data.azurecr.io, so a virtual network needs two private addresses initially, and one more for each geo-replica. Use a subnet of at least /27 for geo-replicated registries. Up to 200 private endpoints are allowed.

az acr update --name REGISTRY --public-network-enabled false

Disabling public access has side effects. az acr build fails unless a dedicated agent pool is used, or the AzureContainerRegistry service tag range is allowed. Microsoft-hosted Azure DevOps agents are not supported, so a self-hosted agent is needed. Private Link and service endpoints cannot be used together. Anonymous pull should remain off, except for a registry that is meant to be public.

True or false

Private registries

Exam skills 3.3.3

Check what happens when a registry is made private.

Log in to try this activity Interactive activities are free with an account.

Image integrity

Signing proves that an image came from a trusted publisher and has not been changed. Docker Content Trust (DCT) is retiring. Since 31 May 2026 it cannot be enabled on new registries or on those that have not previously used it, and it will be removed on 31 March 2028. Disabling it deletes all trust data, and ABAC-enabled registries do not support it.

The replacement is the Notary Project, which uses the Notation tool. Signatures are stored in the registry as OCI artifacts next to the image. Signing uses AcrPush, or Repository Writer in ABAC mode, and a certificate in Key Vault can hold the signing key. Verification at deployment can use a policy controller such as Ratify on AKS. Pinning images by digest rather than tag also protects against a moved tag, because a digest identifies one exact image.

Select all that apply

Signing and integrity

Exam skills 3.3.3

Identify what is true about image signing and integrity in ACR.

Log in to try this activity Interactive activities are free with an account.

Other controls

Defender for Containers scans images in ACR, and raises findings. Repository locks can prevent a tag from being overwritten or deleted, with az acr repository update --write-enabled false. Retention policies and purge tasks remove old images, reducing the volume of vulnerable images. Customer-managed keys can encrypt registry content at rest, on the Premium tier. Diagnostic settings send repository events and login events to a workspace, so that pushes can be audited.

Worked example

Least privilege for a pipeline

A pipeline must push images to one repository in a registry, and AKS must pull from any repository. The registry must not be reachable from the internet, and a self-hosted build agent runs in the virtual network. What should you configure?

Use the Premium tier with a private endpoint, and disable public access. Set the permissions mode to RBAC Registry + ABAC Repository Permissions, and give the pipeline's identity Container Registry Repository Writer, with a condition that names its repository. Give the cluster's kubelet identity a reader role for all repositories.

AcrPush would allow the pipeline to push to every repository. The admin user cannot be limited to one repository. Service endpoints cannot be used alongside Private Link, and they do not make the registry private.

Check yourself

Why deploy an image by digest rather than by tag?

Show answer

A tag can move to another image, whereas a digest identifies one exact image.

Exam Tips

Remember for the exam

  • Keep the admin user disabled.
  • Private Link needs the Premium tier.
  • Docker Content Trust is being removed; use the Notary Project.
  • ABAC or tokens give repository-level permissions.