Your profile

One profile for every MSDEVBUILD site. Only you can see it, and the site owner if you write in.

Lesson 2 of 28
❮Prev Next❯

Azure Container Registry: Store, Tag and Manage Images

Module 1: Containers ⏱ 9 min read Updated

Your note

My notes for this lesson

Select any text in the lesson to highlight it or add a note. Saved in this browser.

    No highlights yet. Select a sentence in the lesson, then pick a colour or add a note.

    All my bookmarks and notes

    Reading settings

    For every lesson, saved in this browser.

    Text size
    Line spacing
    Font

    With IaaS you rent the virtual machine. Microsoft looks after the building, power and hardware; you patch the operating system.

    30-second answer

    Azure Container Registry (ACR) is a private registry at myreg.azurecr.io (your registry name plus azurecr.io) that stores images in repositories. A tag (ragapi:1.4.0) is a movable label, while a digest (sha256:…) identifies the exact image and never changes. You push with docker push after az acr login, copy public images in with az acr import, list versions with az acr repository show-tags, and let hosts pull with a managed identity that has the AcrPull role.

    Simulate it » No Azure account needed

    Exam objective: 1.1.1 Build, store, version, and manage container images by using Azure Container Registry. (Skills measured as of October 7, 2026)

    Simulations

    Feel it before you read it. No account needed, nothing leaves this page.

    Azure portal: Create a registry and push an image Create a registry, then look at repositories, tags and digests.
    </> Embed

    Embed this simulation

    Free for trainers, teachers and bloggers. Paste this into your page:

    Loading the portal…

    Open <strong>Container registries</strong> and select <strong>+ Create</strong>.

    👆 Click the glowing item in the portal to continue

    Read the steps as text
    1. Open Container registries and select + Create.
    2. The registry name becomes your login server, acrcontosoai.azurecr.io. Premium adds geo-replication and private endpoints.
    3. Leave the admin user off. Apps pull with a managed identity and the AcrPull role.
    4. Done. Go to resource.
    5. Push from your machine or Cloud Shell. The tag says which build; the digest says exactly which bytes.
    6. One repository per image name. Open chat-api.
    7. Two tags, one digest. That’s why :latest bites in production: it moves under you.

    🧪 Simulation for learning. Screens are simplified versions of the Azure portal; names, prices and IDs are examples. Nothing here touches real Azure.

    😟 THE PROBLEM

    Production pulled :latest and got last night’s broken build.

    😊 THE SOLUTION

    Store versioned images in a private registry and deploy by tag or digest.

    • Mystery “latest” images✓ Semantic version tags
    • Images on a public hub✓ A private registry with Entra ID
    • Old images pile up✓ Purge and retention rules
    🛠️ Solved with: Azure Container Registry

    Start with a question

    Production broke at 2 a.m. Which version of the app was it actually running?

    The deployment said ragapi:latest. But latest was pushed three times yesterday, by two different people. Nobody can say for sure which build the servers pulled, so nobody knows what to roll back to.

    That’s the problem a registry with good tags and digests solves. Azure Container Registry keeps every image version, and if you tag them properly you always know exactly what’s running.

    Explain it like I’m 10

    The technical explanation

    A registry has a login server (myreg.azurecr.io). Inside it are repositories (ragapi), and each image in a repository has one or more tags and exactly one digest.

    # Create a registry (name: 5-50 letters and numbers, globally unique)
    az acr create --resource-group rg-ai --name myreg --sku Standard
    
    # Sign Docker in with your Microsoft Entra ID account
    az acr login --name myreg
    
    # Tag a local image with the full registry name and push it
    docker tag ragapi:dev myreg.azurecr.io/ragapi:1.4.0
    docker push myreg.azurecr.io/ragapi:1.4.0

    Seeing what’s there

    az acr repository list --name myreg --output table
    az acr repository show-tags --name myreg --repository ragapi --orderby time_desc --output table
    az acr manifest list-metadata --registry myreg --name ragapi   # digests, tags, dates

    To run an exact image regardless of tags, reference the digest: myreg.azurecr.io/ragapi@sha256:….

    Bringing images in

    az acr import copies an image server side, so you don’t need Docker on your machine and you stop depending on Docker Hub rate limits:

    az acr import --name myreg \
      --source docker.io/library/python:3.12-slim \
      --image base/python:3.12-slim

    It works from another ACR too (--source otherreg.azurecr.io/ragapi:1.4.0), including across subscriptions when you have access.

    Tagging so you can trust it

    Tag styleExampleUse it for
    Stable tagragapi:1, ragapi:latestBase images that should pick up patches
    Unique tagragapi:1.4.0, ragapi:build-482, ragapi:3f9c2e1Anything you deploy

    Lock a release so nobody overwrites or deletes it:

    az acr repository update --name myreg --image ragapi:1.4.0 \
      --write-enabled false --delete-enabled false

    Old builds pile up, so clean them: az acr repository delete --name myreg --image ragapi:1.2.0, or run acr purge on a schedule to remove tags older than a set age and untagged manifests.

    1. 1 Sign in

      az acr login gets an Entra ID token for Docker.

    2. 2 Push

      docker push uploads only the layers ACR doesn't have yet.

    3. 3 Version

      The tag 1.4.0 and its sha256 digest now point at the same manifest.

    4. 4 Pull

      A host with AcrPull pulls by tag or digest.

    Push to pull

    Who can pull and push

    MethodWhen
    Your Entra ID account (az acr login)Developers at the command line
    Managed identity + AcrPullApp Service, Container Apps, AKS pulling at run time
    Service principal or workload identity + AcrPushCI/CD pipelines
    Admin accountOff by default; single-user testing only

    SKUs: Basic, Standard and Premium share the same features for storing and pulling. Premium adds the most storage and throughput, geo-replication to other regions and private endpoints.

    Architect level Why digests matter for rollbacks

    When you push, ACR stores the layers and a manifest that lists them. The digest is the hash of that manifest. Kubernetes and Container Apps can resolve a tag to a digest when they start a replica, but if the tag moves between two replica starts, you end up with mixed versions. Deploying by a unique tag, or pinning the digest in the manifest, makes every replica run the same bytes and makes “roll back to the last good build” a one-line change.

    Real-world business scenario

    Healthcare

    Northwind Health (fictional)

    The problem
    Several teams pushed ragapi:latest from their laptops. Production pods ran two different builds after a node restart, and an auditor asked which code processed patient queries on a given day.
    What they used
    A Premium Azure Container Registry with private endpoints. Builds push version tags such as 2.3.1 and lock them; AKS and Container Apps pull with managed identities that have AcrPull.
    Why that choice
    Locked unique tags and digests give a permanent record of what ran, and managed identities removed the shared admin password.
    The result
    Every deployment record now names a digest the auditors can check, and rollbacks are a tag change.

    When to use it and when not to

    ✓ Use it when…

    • You need private images for App Service, Container Apps or AKS.
    • You want to stop depending on public registry rate limits by importing base images.
    • You need geo-replicated images close to clusters in several regions (Premium).

    ✕ Think twice when…

    • Using the admin account for apps in production.
    • Relying on :latest for anything you deploy.

    ↔ Alternatives to consider

    • ACR Tasks to build images inside the registry instead of pushing from laptops.
    • Microsoft Artifact Registry (mcr.microsoft.com) for public Microsoft base images you only pull.
    Ready for more?The full lesson adds the technical explanation, when to use it, interview questions and revision notes.

    Test yourself with exercises

    5 original practice questions in the AI-200 style. Pick your answers, then check them. You will see why each option is right or wrong. Score 75% or more and this topic is marked complete.

    Question 1

    Question 1 of 5

    You need to copy the image python:3.12-slim from Docker Hub into your Azure container registry named contosoacr. The computer that you use does not have Docker installed. Which command should you run?

    Question 2

    Question 2 of 5

    A production deployment references the image contosoacr.azurecr.io/ragapi:latest. After a node restart, some pods run different code from others. What should you do to ensure that every replica runs exactly the same image?

    Question 3

    Question 3 of 5

    You must prevent the image ragapi:2.0.0 in the registry contosoacr from being overwritten or deleted. Which command should you run?

    Question 4

    Question 4 of 5

    Your company runs AKS clusters in three Azure regions. Each cluster must pull images from a registry endpoint in its own region, and the images must be managed as a single registry. Which registry configuration should you use?

    Question 5

    Question 5 of 5

    A developer needs to list all tags in the ragapi repository of the registry contosoacr, with the most recent first. Which command should the developer run?

    Interview preparation

    Say your answer out loud first, then open the model answer. Interviewers care more about your reasoning than the exact words.

    Beginner What's the difference between a tag and a digest?

    Model answer

    A tag is a name I choose, like 1.4.0 or latest, and it can be pointed at a new image later. A digest is the sha256 of the manifest, so it always means the exact same bytes. If I need to be certain what runs in production, I deploy by digest or by a tag nobody reuses.

    Interviewer follows up

    So why not always use latest?

    You

    Because latest moves. Two nodes can pull at different times and run different code, and rolling back is guesswork.

    Intermediate How do you stop a released image from being overwritten?

    Model answer

    I lock it with az acr repository update and --write-enabled false. Pushing the same tag again then fails, and I can also set --delete-enabled false so nobody deletes it by mistake.

    Experienced developer How should App Service, Container Apps and AKS authenticate to ACR?

    Model answer

    With Microsoft Entra ID, not the admin account. I give the host a managed identity and assign AcrPull on the registry. For AKS that's az aks update --attach-acr, which assigns AcrPull to the kubelet identity.

    Scenario Your builds depend on python:3.12-slim from Docker Hub and you keep hitting pull rate limits. What do you do?

    Model answer

    Import the base image into our own registry with az acr import and point the Dockerfile at myreg.azurecr.io/python:3.12-slim. Builds pull from ACR, and we control when that base image changes.

    Quick revision

    Key points

    • Image names are login-server/repository:tag, for example myreg.azurecr.io/ragapi:1.4.0.
    • Tags move; digests don't. Use unique tags (version, build ID, commit) for deployments.
    • az acr login signs Docker in with your Entra ID identity; the admin account is off by default.
    • az acr import copies images between registries without a local Docker engine.
    • az acr repository show-tags lists versions; --write-enabled false locks an image.
    • SKUs are Basic, Standard and Premium; Premium adds geo-replication and private endpoints.

    Important terminology

    Login server
    The registry's address, such as myreg.azurecr.io, used in every image name.
    Repository
    A named collection of related images inside a registry, such as ragapi.
    Tag
    A human-readable label on an image version; it can be moved to a different image.
    Digest
    A sha256 hash of the image manifest that uniquely and permanently identifies one image.
    AcrPull
    The built-in Azure role that lets an identity pull images from a registry.
    az acr import
    Copies an image from another registry into ACR on the server side, without Docker on your machine.

    Common mistakes

    • Deploying :latest to production and losing track of which build is running.
    • Enabling the admin account and sharing its password with every app.

    Exam tips

    • "Copy an image from Docker Hub or another registry without Docker installed" = az acr import.
    • "List all versions of an image" = az acr repository show-tags.
    • "Replicate the registry to several regions" = Premium SKU with geo-replication.

    Five quick revision questions

    1. 1.What is the login server format for ACR?Show

      registry-name.azurecr.io, for example myreg.azurecr.io.

    2. 2.Which value always identifies the exact same image?Show

      The digest (sha256).

    3. 3.Which command signs Docker in to ACR?Show

      az acr login --name myreg

    4. 4.Which SKU supports geo-replication?Show

      Premium.

    5. 5.Which flag on az acr repository update locks an image against overwrite?Show

      --write-enabled false

    Official references

    Finished this lesson? Tick it off. Your progress is saved in this browser.

    Next up: Build and Run Images with ACR Tasks

    Studying with a friend? Send them this lesson

    It's free and needs no sign-up. Their progress saves in their own browser.

    Lesson done? Make it stick with a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges. Play ❯

    Install MSDEVBUILD Azure

    Free · no account · works offline

    Save the whole course for offline ›

    Hi, I’m your Nimbus

    Your study buddy. Pick what we do next.

    MSDEVBUILD · Multi-Stack Dev Build

    Sign in to MSDEVBUILD

    One account for Azure certifications and the blog: sign in here and you are signed in on both. Your XP, streak, practice deck and certificate stay in sync on every device. Optional: everything works without an account.