Your profile

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

Lesson 26 of 47
❮Prev Next❯

Azure Container Registry and Container Instances for Admins

Module 3: Compute ⏱ 11 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 your private image store. You pick a tier: Basic, Standard or Premium, and only Premium adds geo-replication and private endpoints. Apps pull with a Microsoft Entra identity that has the AcrPull role, and the admin user stays off. Azure Container Instances (ACI) runs an image as a container group in seconds, with the CPU and memory you set at creation and a restart policy of Always, OnFailure or Never. ACI bills per second and doesn't autoscale. To change CPU or memory, you recreate the group.

    Simulate it » No Azure account needed

    Exam objective: 3.3.1 Create and manage an Azure Container Registry. 3.3.2 Provision a container by using Azure Container Instances. 3.3.4 Manage sizing and scaling for containers, including Azure Container Instances and Azure Container Apps. (Skills measured as of April 17, 2026)

    Simulations

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

    Azure portal: Create a registry, then run a container group in Container Instances Create a registry, then run a container group from it.
    </> Embed

    Embed this simulation

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

    Loading the portal…

    Start on <strong>Home</strong>. Select the search bar.

    👆 Click the glowing item in the portal to continue

    Read the steps as text
    1. Start on Home. Select the search bar.
    2. Type container registries in the search bar and pick Container registries under Services.
    3. The name is 5 to 50 letters and numbers, no hyphens, and becomes the login server. Standard suits most teams. Choose Premium if you need geo-replication or private endpoints.
    4. A month later Europe wants a nearby copy. Services → Geo-replications says no: it’s Premium only. You can change the tier in place, with no downtime.
    5. In Settings → Properties switch the plan to Premium and Save. Images and tags stay as they are. Keep the admin user off; give pulling identities the AcrPull role.
    6. Type container instances in the search bar and pick Container instances under Services.
    7. Pick the image from your registry and set the size: CPU and memory are fixed for the life of the group. ACI won’t scale them for you.
    8. On Advanced, the restart policy decides what happens when the container exits. On failure fits a job: done is done, and billing stops. Always fits a long-running service.
    9. The job ran and finished. To change CPU or memory later you redeploy the group; for automatic scaling, use Container Apps.

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

    😟 THE PROBLEM

    A nightly job runs on a VM that sits idle 23 hours a day.

    😊 THE SOLUTION

    Keep the image in a private registry and run it in Container Instances only when needed.

    • Paying for an idle VM✓ Per-second billing, restart policy OnFailure
    • Images on a public hub✓ Private registry with AcrPull
    • Slow pulls in Europe✓ Premium geo-replication
    🛠️ Solved with: ACR + Container Instances

    Start with a question

    Why pay for a server all day for a job that runs for five minutes?

    Think of a bakery that bakes a special cake once a night. It doesn’t buy a second oven and leave it on all day. It keeps the recipe in a locked cupboard, rents an oven for five minutes each night, and hands the oven back when the cake is done.

    In Azure the locked cupboard is Azure Container Registry: your private images, safe and versioned. The rented oven is Azure Container Instances: it runs one image as a container group, with the CPU and memory you ask for, and stops when the job is done if you tell it to.

    Explain it like I’m 10

    The technical explanation

    Azure Container Registry: create and manage it

    A registry name is 5 to 50 letters and numbers, no hyphens, and it becomes the login server: acrcontoso.azurecr.io. Images live in repositories and are named by tag (invoice-job:v1) or by digest (sha256:…).

    TierIncluded storageGood forPremium-only extras
    Basic10 GiBLearning and small teams
    Standard100 GiBMost production teams
    Premium500 GiBLarge, global or locked-down setupsGeo-replication, private endpoints, the highest throughput

    You can move between tiers in place. Upgrading to Premium doesn’t move or rebuild images, and there’s no downtime.

    Portal: search Container registries, select + Create, fill in Registry name, Location and Pricing plan, then Review + create. Later, Settings → Properties changes the plan and Services → Geo-replications adds regions.

    az acr create -g rg-admin-apps -n acrcontosoadm01 --sku Standard
    az acr import -n acrcontosoadm01 --source mcr.microsoft.com/azuredocs/aci-helloworld:latest --image aci-helloworld:v1
    az acr update -n acrcontosoadm01 --sku Premium
    az acr replication create -r acrcontosoadm01 -l westeurope
    New-AzContainerRegistry -ResourceGroupName rg-admin-apps -Name acrcontosoadm01 -Sku Standard -Location eastus
    Update-AzContainerRegistry -ResourceGroupName rg-admin-apps -Name acrcontosoadm01 -Sku Premium

    Who can pull? Give the app’s managed identity (or a service principal) the AcrPull role on the registry. AcrPush adds push. The admin user is one shared username and password for the whole registry; it’s off by default, and you should keep it that way outside quick tests.

    Azure Container Instances: provision a container

    ACI deploys a container group: one or more containers scheduled on the same host, sharing a lifecycle, an IP address and any mounted volumes (such as an Azure Files share). Linux groups can hold several containers; Windows groups are more limited.

    Portal: search Container instances, select + Create. On Basics: container name, region, Image source (Quickstart images, Azure Container Registry, Other registry), image and tag, OS type and Size (vCPU and memory). Networking sets Public or Private, a DNS name label and ports. Advanced holds the restart policy, environment variables and command override.

    az container create -g rg-admin-apps -n aci-invoice-job \
      --image mcr.microsoft.com/azuredocs/aci-helloworld \
      --cpu 1 --memory 1.5 --restart-policy OnFailure --os-type Linux

    For an image in your own registry, add --registry-login-server, --registry-username and --registry-password, or --acr-identity with a managed identity that has AcrPull.

    Sizing and scaling ACI

    SettingWhat to know
    CPU and memoryRequested per container when you create the group. Most regions give a standard Linux group up to 4 vCPU and 16 GB.
    Changing sizeNot in place. CPU, memory, OS type and restart policy need a delete and recreate.
    ScalingNone built in. More load means more groups that you create, or a move to Container Apps or AKS.
    BillingPer second of vCPU and memory while the group runs.
    Restart policyBehaviourUse it for
    Always (default)Restarts the container whenever it stopsLong-running services
    OnFailureRestarts only on a non-zero exit codeBatch jobs that should retry on error
    NeverRuns once and stays stoppedOne-off tasks you want to inspect after
    Architect level Why not just use the admin user?

    The admin user is one credential shared by everyone and everything, with push and pull rights. You can’t tell who used it, and rotating it breaks every app at once. With Microsoft Entra ID, each app’s managed identity gets exactly AcrPull on one registry, you see it in the activity log, and nothing has a password to leak. Some older tools still need the admin user; if you must use it, rotate the password and turn it off again when you’re done.

    Real-world business scenario

    Finance

    Contoso Finance (fictional)

    The problem
    An invoice-matching job ran each night on a D4s VM that stayed on all day. Images sat in a public Docker Hub repository, and the European office complained that pulls were slow.
    What they used
    A Premium Azure Container Registry in East US with a West Europe replica, pulled by managed identities with AcrPull. The nightly job runs in Azure Container Instances with 2 vCPU, 4 GB and restart policy OnFailure, started by a Logic App at 02:00.
    Why that choice
    Per-second billing for a 20-minute job instead of a full-time VM, private images with no shared password, and local pulls in Europe.
    The result
    The job costs a few dollars a month instead of a full VM bill, and the VM was deleted. Failed runs retry on their own, and successful ones stop billing the moment they finish.

    When to use it and when not to

    ✓ Use it when…

    • You need private, versioned images for any Azure container host.
    • A job runs on a schedule or on demand and should stop when it finishes.
    • You want a single container running in seconds without a VM or cluster.

    ✕ Think twice when…

    • The app must scale out and in with traffic. Use Container Apps.
    • You need deployment slots, custom domains and backups for a web app. Use App Service.
    • You only ever pull public images you never change, so a registry adds little.

    ↔ Alternatives to consider

    • Azure Container Apps for container apps that scale on HTTP or events, down to zero.
    • Azure Kubernetes Service when you need the full Kubernetes API.
    • Azure App Service for web apps that run from a container image with slots and TLS.
    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 AZ-104 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

    Contoso has an Azure container registry named acrcontoso in the East US region. The registry uses the Standard service tier. Developers in West Europe report slow image pulls.

    You need to provide a copy of the registry in West Europe while keeping a single registry name. What should you do first?

    Question 2

    Question 2 of 5

    An Azure container app must pull images from an Azure container registry without storing a password. Which configuration should you use?

    Question 3

    Question 3 of 5

    A container in Azure Container Instances processes invoices once each night. It must stop after it completes successfully and must start again only if it exits with an error.

    Which restart policy should you configure?

    Question 4

    Question 4 of 5

    A Linux container group in Azure Container Instances was created with 1 vCPU and 1.5 GB of memory. The workload now requires 4 GB of memory. What should you do?

    Question 5

    Question 5 of 5 · Select 2

    Which two statements about Azure Container Instances are true? Each correct answer presents a complete solution.

    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 Azure Container Registry and Azure Container Instances?

    Model answer

    ACR stores images and ACI runs them. The registry is like a private shelf of packaged apps. Container Instances takes one of those packages and runs it as a container group, with the CPU and memory I choose, without me building any VM or cluster.

    Intermediate Which ACR tier would you choose for a team in the US and Europe that wants fast pulls in both places?

    Model answer

    Premium, because geo-replication is Premium only. I'd add a replica in the European region so pulls there stay local, and pushes to either region sync to both. If the registry is Standard today, I can upgrade it in place with az acr update --sku Premium, and the images stay where they are.

    Experienced developer A container group needs more memory. How do you change it?

    Model answer

    I can't resize it in place. CPU, memory, the OS type and the restart policy are fixed properties, so I delete the container group and create it again with the new values, usually from the same YAML or ARM template. If it keeps needing more capacity under load, it probably belongs in Container Apps, which scales on rules.

    Scenario A nightly ACI job keeps running and costing money after it finishes. What's wrong?

    Model answer

    The restart policy is almost certainly Always, the default, so ACI restarts the container every time it exits. For a job I'd set OnFailure, so it reruns only if it fails, or Never if a failure should be looked at by a person. Then the group stops after the run and billing stops with it.

    Quick revision

    Key points

    • ACR tiers are Basic, Standard and Premium. Premium adds geo-replication, private endpoints and the most included storage.
    • You can change an ACR tier in place with az acr update --sku, with no downtime.
    • Pull with a managed identity or service principal that has AcrPull. Keep the admin user disabled.
    • ACI deploys a container group with fixed CPU and memory, a restart policy and optional public IP and DNS label.
    • ACI doesn't autoscale. Changing CPU, memory or restart policy means deleting and recreating the group.

    Important terminology

    Azure Container Registry
    A managed, private registry for container images and other OCI artifacts, reached at <name>.azurecr.io.
    Login server
    The registry's address, such as acrcontoso.azurecr.io, used in image names and when apps sign in.
    Geo-replication
    A Premium ACR feature that keeps a copy of the registry in other regions, so pulls are local and one registry name works everywhere.
    AcrPull
    The built-in role that lets an identity pull images from a registry. AcrPush also allows pushing.
    Container group
    The unit ACI deploys. One or more containers on the same host that share a lifecycle, network and storage.
    Restart policy
    What ACI does when a container exits. Always (default) restarts it, OnFailure restarts only on a non-zero exit code, Never leaves it stopped.
    Admin user
    A single shared username and password for a registry. It's off by default and should stay off for production.

    Common mistakes

    • Leaving the restart policy on Always for a batch job, so it loops and keeps billing.
    • Expecting Container Instances to scale out under load.
    • Choosing Standard ACR and then needing geo-replication or a private endpoint.

    Exam tips

    • "Replicate the registry to another region" = Premium ACR.
    • "Run once, restart only if it fails" = restart policy OnFailure.
    • "Increase memory of an existing container group" = delete and redeploy the group.

    Five quick revision questions

    1. 1.Which ACR tier supports geo-replication?Show

      Premium.

    2. 2.What is the default ACI restart policy?Show

      Always.

    3. 3.Which role lets an app pull images from ACR?Show

      AcrPull.

    4. 4.Does Azure Container Instances autoscale?Show

      No. You size each container group yourself.

    5. 5.Which CLI command creates a container group?Show

      az container create (with --cpu, --memory and --restart-policy).

    Official references

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

    Next up: Provision and Scale Azure Container Apps

    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.