Lesson 2 of 3 Container Images and Azure Container Registry

Understanding Azure Container Registry

This lesson explains what Azure Container Registry provides, how its tiers differ, and how clients authenticate and are authorized to pull and push.

Learning outcomes

After completing this lesson, you will be able to:

  • Compare the Basic, Standard and Premium tiers.
  • Choose an authentication method for a host or a pipeline.
  • Distinguish AcrPull from AcrPush.
  • Explain why the admin user should stay disabled.

What ACR provides

Azure Container Registry is a managed, private registry for container images and other OCI artifacts. Each registry has a globally unique name that forms its login server, NAME.azurecr.io. Because it is an Azure resource, ACR integrates with Microsoft Entra ID for authentication, with Azure role-based access control for authorization, with Azure Monitor for logs and metrics, and with Azure networking features such as private endpoints.

ACR also builds images. Its ACR Tasks feature, covered in the next module, runs builds in Azure, so a developer or a pipeline needs no local Docker engine. Every Azure container host, including App Service, Container Apps, AKS, Azure Container Instances and Azure Functions on Container Apps, can pull directly from ACR.

Service tiers

ACR is offered in three tiers. All tiers have the same API and the same core features; they differ in included storage, in throughput for pulls and pushes, and in the advanced features they unlock. A registry can be moved between tiers at any time.

Basic
Intended useLearning and low-volume development
Throughput and storageLowest included storage and throughput
Geo-replicationNo
Private endpointsNo
Other Premium featuresNo
Choose when A lab or a personal project
Standard
Intended useMost production workloads
Throughput and storageMore storage and throughput
Geo-replicationNo
Private endpointsNo
Other Premium featuresNo
Choose when A typical production application in one region
Premium
Intended useHigh-volume and enterprise workloads
Throughput and storageHighest storage and throughput
Geo-replicationYes
Private endpointsYes
Other Premium featuresCustomer-managed keys, connected registries, retention policy for untagged manifests
Choose when Several regions, private networking or strict compliance

The choice usually turns on networking and geography. A registry that must be reachable only over a private endpoint, or that must replicate images close to hosts in several regions, must be Premium. Throughput matters when many nodes pull large images at the same time, for example when an AKS cluster scales out quickly.

Scenario questions

Which ACR tier?

Exam skills 1.1.1

Choose the lowest ACR tier that meets each requirement.

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

Authentication options

Every pull and push must be authenticated, except for registries configured to allow anonymous pulls. ACR supports several methods, and the exam expects you to choose the most secure one that fits the client.

  • Individual sign-in: a developer runs az acr login --name NAME, which exchanges their Microsoft Entra token for a registry token that a local Docker or Podman client uses.
  • Managed identity: an Azure service such as App Service, Container Apps or an AKS node pool uses its managed identity to pull, with no stored password. This is the preferred method for hosts.
  • Service principal or workload identity federation: a pipeline outside Azure authenticates as an Entra application; federation avoids storing a client secret.
  • Repository-scoped tokens: a token with a scope map that grants actions on named repositories only, useful for external partners or devices.
  • Admin user: a single user name and two passwords for the whole registry. It is disabled by default, cannot be scoped, and is intended only for testing.

Avoid the admin user

Enabling the admin user and storing its password in an app setting is a frequent wrong answer. It gives every holder full push and pull rights to every repository, and the password cannot be tied to a single application. A managed identity with AcrPull is both simpler and more secure.

Match the pairs

Who signs in how?

Exam skills 1.1.1

Match each client with the most suitable way to authenticate to ACR.

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

Roles for registry access

Authorization uses Azure roles assigned on the registry. The two that appear most often are deliberately narrow: AcrPull lets an identity pull images, and AcrPush lets it pull and push. AcrDelete allows an identity to delete images, which is usually reserved for clean-up automation. Owner and Contributor manage the registry resource and include data access, so they are not appropriate for a host that only needs to pull.

Registries can also use attribute-based access control (ABAC) for repository permissions. In that mode, role assignments can carry conditions that limit them to repositories whose names match a prefix, so that one team's pipeline can push only to team-a/*. The registry's role assignment permissions mode decides whether the classic roles or the ABAC-enabled repository roles apply.

The following commands create a registry and give an App Service app's managed identity the right to pull from it. The placeholders in capitals are replaced with real names.

az acr create --resource-group RG --name REGISTRY --sku Standard
ACR_ID=$(az acr show --name REGISTRY --query id -o tsv)
PRINCIPAL=$(az webapp identity assign --resource-group RG --name APP --query principalId -o tsv)
az role assignment create --assignee-object-id $PRINCIPAL --assignee-principal-type ServicePrincipal \
  --role AcrPull --scope $ACR_ID

The following diagram shows how each identity reaches the registry and the role it holds.

Least-privilege registry access without stored passwords. The GitHub Actions workflow runs outside Azure, so it signs in through workload identity federation to a Microsoft Entra application that holds AcrPush. The container app only pulls, so its managed identity holds AcrPull. The admin user would be one stored password with full rights.
Neither identity stores a secret.
Sort into groups

Least-privilege registry roles

Exam skills 1.1.1

Choose the narrowest role for each identity.

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

Granting a pipeline and a host the right access

A GitHub Actions workflow builds images and pushes them to ACR. A Container Apps app runs those images. The security team forbids stored passwords and wants each identity to have only the rights it needs. Which configuration meets these requirements?

The workflow should authenticate with workload identity federation to a Microsoft Entra application that holds AcrPush on the registry, because it must push and runs outside Azure. The container app should use a managed identity that holds AcrPull, because it only pulls. Neither identity stores a secret.

Enabling the admin user would satisfy both clients with one credential, but it is a stored password with full rights. Giving the workflow Contributor on the registry would let it push, but also change or delete the registry itself. Giving the app AcrPush would let a compromised app overwrite images.

Check yourself

A Container Apps app must only pull images from a registry. Which role should its managed identity hold, and why not AcrPush?

Show answer

AcrPull. It allows pulling only. AcrPush also allows pushing, so a compromised app could overwrite images, which breaks least privilege.

Exam Tips

Remember for the exam

  • Hosts pull with a managed identity holding AcrPull.
  • Pipelines push with AcrPush, preferably through workload identity federation.
  • The admin user is disabled by default and suits only testing.
  • Geo-replication and private endpoints need the Premium tier.