Build and run images with ACR Tasks
What one task run actually does
Run az acr build --registry myregistry --image helloacrtasks:v1 --file Dockerfile . and the console prints Packing source code into tar file to upload..., then Queued a build with build ID: da1, then Waiting for build agent..., and a minute later the image is in the registry. Nothing on your machine built it. Your Dockerfile expertise transfers directly, because ACR Tasks[1] still runs docker build; only the command you type changes.
The ACR image management page owns an image once it exists in the registry: tagging strategy, digests, locks, import, and cleanup. This page owns how it got there and how it gets rebuilt: the four ways a build gets started, how a requirement's wording picks between them, and the one YAML file that lets a single run build, test, and publish.
The vocabulary this page uses
Azure Container Registry Tasks (ACR Tasks) is the set of features inside Azure Container Registry that builds container images on Azure compute for Linux, Windows, and Arm. Three words recur:
- A build context is the location of the source files a build reads, exactly as with a local
docker build. It is the positional argument ofaz acr build: a local directory, a Git URL, a remote tarball, or an artifact already in a registry, each covered in the next section. - A run is one execution. Every run gets a short run ID such as
da1that names its logs and is commonly reused as the image tag. - A task is a saved Azure resource created with
az acr task createthat holds a context, a Dockerfile path, an image name, and its triggers. A quick task is the exception: it runs without leaving a task resource behind.
The shape of every run
The figure below traces those steps in order. Whichever of the three task scenarios started it (quick task, automatically triggered task, multi-step task, in that order below), a run always: takes a context; uploads or clones it; queues, at which point the run ID is assigned; waits for a build agent, which is Azure's compute, not yours; builds; and, in the quick-task case, pushes, leaving a run record: logs, status, and what it discovered. Near the end of the output, ACR Tasks reports the dependencies it discovered[2] for the image, including the registry, repository, tag, and digest of the base image the FROM instruction resolved to. That dependency record is the entire basis of base-image tracking, which a later section builds on.
Reading what a run did
Every run produces log output. A manually triggered run streams it to your console and stores it; an automatically triggered run only stores it, so you read it afterwards with az acr task logs or in the portal. az acr task list-runs --registry myregistry --output table prints one row per run with a RUN ID, TASK, PLATFORM, STATUS, TRIGGER, STARTED, and DURATION column. TRIGGER is the column that tells you what started the run, and its four values (Manual, Commit, Image Update, Timer) organise the next four sections. The section after those covers the multi-step YAML file, which changes what a run does rather than what starts it: those two axes cover every mechanism on this page.
One consequence worth carrying forward: because the build happens in Azure rather than on the caller's machine, the caller needs Azure permissions rather than a container runtime. That is what makes ACR Tasks usable from Cloud Shell, from a pipeline agent, or from a workstation where installing Docker is not allowed.
Quick tasks: building one image on demand
A quick task is a build that leaves no task resource behind. You get the build, the logs, and the pushed image; you do not get anything you can trigger later. That is the whole difference between az acr build and az acr task create, and it is why the tutorials use a quick task to seed a base image and a task to react to it.
What you point it at
The positional argument is the context. The documented context locations[1] are a local file-system directory, a GitHub repository (optionally narrowed to a branch, a subfolder, or a commit hash), an Azure DevOps repository subfolder, a remote tarball on a web server, and an OCI artifact already in a container registry. A local directory is packed into a tar file and uploaded, which is the line you see first in the output.
Two details about a local context surprise people. The .git folder is excluded from the uploaded package by default[3], and a .dockerignore file containing !.git/** is what restores it; the same behaviour applies to az acr run. And -f/--file is the path of the Dockerfile relative to the source-code root folder[4], defaulting to Dockerfile, so a repository holding Dockerfile-app and Dockerfile-base side by side is normal rather than exotic.
The context, the Dockerfile path, and the platform come together in the form you would actually type.
Listing 1: a quick task that builds an Arm64 image without publishing it
# --image/-t names the image; {{.Run.ID}} makes each build's tag unique.
# --file/-f is relative to the context root, not to your shell's directory.
# --platform takes OS/architecture/variant; the default is Linux on AMD64.
# --no-push compiles for validation only and leaves the registry untouched.
az acr build \
--registry myregistry \
--image samples/api:{{.Run.ID}} \
--file docker/Dockerfile-app \
--platform Linux/arm64/v8 \
--no-push \
.
# ... other optional arguments (--build-arg, --secret-build-arg, --target) omitted
The --image value above uses {{.Run.ID}}, one of the run variables covered with multi-step tasks below. It gives every build a tag that no other build reuses; why that matters for what you deploy is the unique-tag discussion on the ACR image management page.
Push is the default, and that is a quick-task property
az acr build pushes the built image to the registry when the build succeeds, and --no-push is a flag you add to prevent it[4]. Remember which way round that default runs, because the multi-step build step behaves the opposite way.
Three more flags worth recognising
--build-arg sets build-time variables and its value is visible to the ACR team for debugging, so --secret-build-arg is the one for anything sensitive. --platform accepts OS, OS/architecture, or OS/architecture/variant; Linux images can target AMD64, ARM, ARM64, and 386, while Windows images are AMD64 only.
A quick task is also the shape a continuous-integration system uses. Sign in with a service principal via az login[1] and the pipeline can issue az acr build commands directly, which is a smaller moving part than installing and authenticating a Docker daemon on every build agent. A quick task is the whole build compressed into one command: the only decisions it asks of you are the context, the Dockerfile, the platform, and whether to publish.
Rebuild on a source commit
The commit trigger is the first reason to create a task instead of running a quick build: you want the rebuild to happen without anyone typing anything. Creating the task with a Git context is all it takes, because the commit trigger is enabled by default[5] and ACR registers the repository webhook for you.
Here is that task, with every trigger flag deliberately left at its default.
Listing 2: a task that rebuilds on every commit to one branch
# --context pins the source: repository, then #branch, then :subfolder.
# --git-access-token lets ACR create the webhook and read the repo.
# No trigger flag appears here: commit is on by default with a Git context.
az acr task create \
--registry myregistry \
--name taskhelloworld \
--image helloworld:{{.Run.ID}} \
--context https://github.com/myorg/acr-build-helloworld-node.git#main:src \
--file Dockerfile \
--git-access-token $GIT_PAT
# ... --schedule and --assign-identity omitted; both are covered below
The context fragment is a filter, not a comment
The #main:src fragment on --context binds the task to one branch and one subfolder[6]. A commit to a different branch reaches the webhook and starts nothing, which is what the figure below shows as the dead-end path. That is a feature in a monorepo and a mystery when it is unintentional, so when a task appears not to fire, compare the branch you pushed with the branch in the task's --context. A commit that does fire it shows Commit in the TRIGGER column of az acr task list-runs.
The token the webhook needs
ACR needs a credential from your Git host, a personal access token (PAT), to set the webhook[1] in the repository. A personal access token is one your Git host issues on behalf of your account and scopes to a list of permissions, and the webhook it buys is registered in the Git repository, not on the registry. The required scopes are exactly these:
| Repo type | GitHub | Azure DevOps |
|---|---|---|
| Public repo | repo:status and public_repo |
Code (Read) |
| Private repo | repo (full control) |
Code (Read) |
Microsoft also warns that anything on the command line or in a URI may be logged in ACR diagnostic tracing[1], naming personal access tokens explicitly, which is a reason to pass the token from a variable rather than pasting it.
Commit and pull request are two different triggers
On a Git context, ACR Tasks supports a Commit trigger, enabled by default, and a Pull request trigger, disabled by default[5] and turned on with --pull-request-trigger-enabled true. Treat any statement that a commit trigger also covers pull requests as false.
Which Git service you use decides whether automation is available at all. The FAQ's support matrix[3] lists GitHub and Azure Repos as supporting both manual builds and auto-build through the commit trigger, while GitLab and Bitbucket work as a source context for manual builds only. GitHub Enterprise repositories support neither commit nor pull-request triggers.
Once the task exists, az acr task run --registry myregistry --name taskhelloworld starts it immediately, independent of any trigger. Do that once before trusting the automation: it proves the definition builds, and it is also the step that registers base-image tracking, which the next section turns into a trigger of its own.
Rebuild when the base image changes
This trigger is the reason ACR Tasks exists as more than a remote docker build. A base image is the parent image a Dockerfile's FROM instruction names[7], typically carrying the operating system and sometimes a framework, and it is where OS and framework security patches arrive. When the maintainer republishes it, every application image built on top of it is stale until someone rebuilds it. The base-image-update trigger is what makes that rebuild automatic.
Tracking is discovered, never declared
ACR Tasks dynamically discovers base-image dependencies while it builds an image, which is the dependency block printed at the end of a run. Two consequences follow, and both are exam-grade.
First, a task tracks nothing until it has built successfully at least once, so you must trigger it once[7], typically with az acr task run. The base-image tutorial does exactly this: it creates the task, runs it manually so the dependency is recorded[8], and only then patches the base image.
Second, tracking is not something you write in the task definition. There is no list of base images to maintain; there is a trigger you leave on or turn off, and --base-image-trigger-enabled is True by default[5] on every task created with az acr task create.
Where the base image has to live, and what it has to be tagged
Detection covers four locations, and this list is exhaustive: the same Azure container registry the task runs in, another private Azure container registry in the same or a different region, a public repository in Docker Hub, and a public repository in the Microsoft Container Registry (MCR). If the FROM image sits in one of those, ACR adds a hook so the image is rebuilt whenever its base is updated.
The tag matters as much as the location. To trigger a task on a base-image update the base must have a stable tag, such as node:9-alpine, because a stable tag is the one that gets re-pointed at each serviced release. A base republished under a brand-new version tag does not trigger a task: nothing your Dockerfile refers to changed. Pinning FROM by digest is the same situation taken to its limit, since a digest names fixed content that cannot be re-pointed at all. A stable tag is also exactly what the ACR image management page tells you not to deploy from, and both rules hold at once: a base image is meant to roll forward so the images built on it inherit patches, while a deployment is meant to stay put[9] so a restart cannot pull something different from its peers. Keep the stable tag in FROM, and a unique tag on what you deploy.
How quickly it fires
The delay depends on where the base lives, and the figure below shows both paths. For a base image in an Azure container registry, in the same registry or any other, the task is triggered immediately[7]. For a base image in a public Docker Hub or MCR repository, ACR Tasks checks for updates at a random interval of between 10 and 60 minutes, and dependent tasks run after that check. Either way the rebuild shows Image Update in the TRIGGER column. This is one of the practical arguments for Microsoft's recommendation to copy public base content into your own registry and build FROM the private copy.
One documented blind spot
An ACR task only tracks base-image updates for application, or runtime, images. It does not track base-image updates for the intermediate buildtime images of a multi-stage Dockerfile. A multi-stage build whose first stage compiles against a patched SDK image will not rebuild on that SDK's update; only the base of the final runtime stage is tracked. Matching that, --base-image-trigger-type defaults to Runtime.
Taken together: leave the trigger on, run the task once, keep FROM pointing at a stable tag in a tracked registry, and OS patching becomes something the registry does rather than something a person remembers.
Run a task on a schedule
A timer trigger runs a task on a fixed schedule and reacts to nothing else. It is the right answer when the requirement is periodic ("every night", "every weekday at noon") and the wrong answer when the requirement is causal ("when the base image is patched"), because a schedule can only shorten the window between an event and the rebuild, never close it.
Add one at creation time with --schedule and a cron expression, and note that a scheduled task does not need source code at all[10]: passing --context /dev/null with --cmd gives you a container that runs on a timer, which is how registry maintenance work is usually shaped.
Listing 3: a nightly task with no source context
# --cmd runs a container instead of building an image.
# --context /dev/null means there is no source code to fetch.
# --schedule is a five-field cron expression, always interpreted as UTC.
az acr task create \
--registry myregistry \
--name timertask \
--cmd mcr.microsoft.com/hello-world \
--context /dev/null \
--schedule "0 21 * * *"
The cron dialect, precisely
ACR Tasks interprets cron expressions with the NCronTab library, and supported expressions have five required fields separated by white space[10]: {minute} {hour} {day} {month} {day-of-week}. Three rules cover most mistakes:
- The time zone is always Coordinated Universal Time (UTC) and hours are in 24-hour format.
"0 12 * * Mon-Fri"is noon UTC on weekdays, whatever your own clock says. - The
{second}and{year}fields are not supported. An expression copied from a system that uses six or seven fields has to have them removed. - Frequencies of up to once per minute are supported, so
"*/5 * * * *"(every five minutes) is fine and sub-minute scheduling does not exist.
Days of week are 0 to 6 starting at Sunday, and names such as Monday or the recommended three-letter Mon work too, case-insensitively.
More than one timer, and timers beside other triggers
A task may carry several timer triggers as long as their schedules differ, and they can be named for easier management or left to take a default name. If two schedules coincide, ACR Tasks triggers the task once for each timer. After creation, az acr task timer add, update, list, and remove manage them individually.
Triggers are not exclusive, which does not undo the rule this section opened with: the timer itself still reacts to nothing but the clock, while the task it is attached to can carry the commit and base-image triggers alongside it. az acr task show --output table prints the enabled set in a TRIGGERS column, which is the quickest way to see that a task you thought was schedule-only also reports BASE_IMAGE. The base-image trigger being on by default is exactly how that happens.
The canonical scheduled workload is registry maintenance. A cmd step running the acr image alias can list and purge old tags on a nightly schedule, using the acr purge command[11] inside the task. What purge actually deletes, and the digest-pinning warning attached to it, is covered on the ACR image management page; the timer trigger is only the clock that starts it. The line to carry out of this section: a timer answers how often, never in response to what.
Multi-step tasks in acr-task.yaml
One image built and pushed is the single-step case. A multi-step task replaces it with a series of steps in a YAML file[12], each of which builds an image, pushes images, or runs a container, and each of which uses a container as its execution environment. That is what makes build, test, then publish possible inside one run instead of across three systems.
Three step types, and the push that is not automatic
buildbuilds a container image using familiardocker buildsyntax, taking-tfor the image name and tag,-ffor the Dockerfile, and a context.pushpushes built or retagged images to a registry, given a collection of image references.cmdruns a container as a command, passing parameters to itsENTRYPOINT, which is how unit and functional tests execute inside a run.
The reference is explicit that unlike az acr build, running ACR Tasks does not provide default push behaviour[11]: the default assumption is build, validate, then push. An image built by a build step and never named in a push step exists only for the duration of the run, which is exactly what you want for a test image and exactly what surprises you if you expected the quick-task default.
Ordering: sequential by default, when for anything else
Give a step an id and other steps can name it. The when property then controls execution: when: ["-"] declares no dependency, so the step starts immediately and runs concurrently with other such steps, while when: ["id1", "id2"] holds the step until both named steps finish. If a step has no when at all, it depends on the previous step in the file, which is why a simple two-line build-and-push YAML works without any dependency wiring.
The figure below draws the dependency graph of the worked example: build-app and build-tests start together, run-app follows the first of them, tests runs against the running container, and push happens only after tests succeeds.
Variables instead of hard-coded names
Run variables are available to steps as {{.Run.VariableName}}, and as of YAML version v1.1.0 most have a shorter alias used with a $ prefix. The ones that matter in practice are Run.ID ($ID), the unique identifier of the current run and the usual source of a unique image tag; Run.Registry ($Registry), the fully qualified login server of the registry the task is running in; Run.RegistryName ($RegistryName) for steps that want the bare name; and Run.Commit and Run.Branch, populated for a task triggered by a commit to a GitHub repository. Writing $Registry/hello-world:$ID instead of myregistry.azurecr.io/hello-world:v1 is what lets the same YAML file run in any registry. A value can also be supplied at run time: a placeholder such as {{.Values.tag}} is filled by az acr task run --set tag=v2.
The two timeouts
Two different timeouts apply, and confusing them wastes an afternoon. The step timeout is the maximum number of seconds one step may run, defaulting to 600 (10 minutes), settable per step as timeout or for all steps as the task-level stepTimeout. The run timeout is a property of the task itself, set with --timeout on az acr task create and defaulting to 3600 seconds[5]; if it is smaller than the sum of the step timeouts, it takes priority.
Credentials without a secret in the file
A task can carry a managed identity, which is an identity in Microsoft Entra ID that Azure manages for the resource[13] so no credentials appear in the task steps. Enable a system-assigned identity by passing --assign-identity with no value, or a user-assigned one by passing the identity's resource ID, then grant that identity a role on whatever the task must reach: pull or push on another registry, or read access on a key vault. A secrets block can then reference a Key Vault secret URL, and az acr task credential add --use-identity attaches the identity to another registry's login server.
A multi-step file runs on demand with az acr run --registry myregistry -f acr-task.yaml <context>, or becomes a task with az acr task create -f acr-task.yaml, at which point every trigger in this page applies to it unchanged.
Full build, test, and push acr-task.yaml
Every step below carries an explicit id so the when properties can name it. $Registry and $ID expand at run time to the registry's login server and this run's unique ID, so the file is portable between registries.
version: v1.1.0
stepTimeout: 600 # seconds per step; the task's own --timeout defaults to 3600
steps:
# Both builds declare no dependency, so they start together.
- id: build-app
build: -t $Registry/hello-world:$ID -f Dockerfile .
when: ["-"]
- id: build-tests
build: -t hello-world-test -f Dockerfile ./funcTests
when: ["-"]
# The application container must be running before tests can hit it.
- id: run-app
cmd: $Registry/hello-world:$ID
when: ["build-app"]
# env passes the target address to the test container.
- id: tests
cmd: hello-world-test
env: ["TEST_TARGET_URL=run-app"]
when: ["run-app"]
# Nothing above published anything: this is the only step that pushes.
- id: push
push: ["$Registry/hello-world:$ID"]
when: ["tests"]
# ... volumes and secrets blocks omitted
Note that hello-world-test carries no registry prefix, so it never leaves the run: it is built, used, and discarded. Only the image named in the push step reaches the registry.
Exam-pattern recognition
Questions on this objective are almost always a scenario plus a requirement verb, and the verb selects the mechanism. Read for the event first.
"...without installing Docker" / "...from Cloud Shell" / "...offload the build". The answer is az acr build, a quick task. Distractors that install a container runtime on a build agent or push from a developer workstation are solving a problem the service already removed.
"...automatically when developers commit". A task created with a Git context. Watch for two traps in the options: an answer that claims the commit trigger also covers pull requests (a separate trigger, off by default), and an answer built on GitLab or Bitbucket, which support manual builds but no commit trigger.
"...whenever the base OS image is patched" / "...keep application images current with framework updates". The base-image-update trigger, which needs no configuration beyond leaving it enabled. The strongest distractor is a schedule; the correct reasoning is that a timer is periodic and the requirement is causal. If the scenario mentions a Dockerfile that pins FROM by digest, or a base whose new release carries a new version tag, or a base image used only by an early stage of a multi-stage build, then no rebuild happens and the option promising one is wrong.
"...nothing happened when the base image was updated". Check whether the task has ever run. Dependencies are discovered during a build, so a task created but never run tracks nothing.
"...every night at 02:00" / "...periodic cleanup". A timer trigger with a five-field UTC cron expression. An option offering "0 2 * * * *" has a seconds or year field that ACR Tasks does not accept.
"...run tests against the image and publish only if they pass". A multi-step task. The discriminator is that the YAML build step does not push, so the correct answer includes an explicit push step gated with when.
"...which run started this build". az acr task list-runs and its TRIGGER column: Manual, Commit, Image Update, or Timer. A question that describes the evidence rather than the configuration is asking you to read that column backwards to the trigger.
One last discrimination that catches people out: az acr build and az acr task run both start a build immediately and both appear as Manual, but only the second one exercises a saved task definition with its triggers, its context, and its image name. Testing a task means az acr task run; building an image once means az acr build.
How a run gets started, as reported in the TRIGGER column of az acr task list-runs
| Consideration | Manual | Commit | Image Update | Timer |
|---|---|---|---|---|
| What starts the run | You do, with az acr build for a one-off build or az acr task run for a saved task | A commit pushed to the branch named in the task context, delivered by a webhook ACR registers | A new push of the base image the task's FROM instruction depends on | A cron expression attached to the task with --schedule |
| On by default | Always available, no configuration | Yes on a task with a Git context (commit-trigger-enabled True); the pull-request trigger is separate and off | Yes (base-image-trigger-enabled True) | No, a task has a timer only if you add one |
| What it needs first | Permission on the registry | A personal access token so ACR can create the webhook, and a GitHub or Azure Repos repository | One successful earlier run so the dependency is discovered, and a stable-tagged base in a tracked location | A five-field cron expression in UTC |
| Delay between event and run | None, you are waiting for it | As soon as the webhook is delivered | Immediate for a base in an Azure container registry; a 10 to 60 minute check interval for Docker Hub and Microsoft Container Registry | At the scheduled minute, once per minute at finest |
| Suits | Inner-loop builds, validating a new task definition, and CI systems calling the CLI | Continuous integration on source change | Automated OS and framework patching | Maintenance and monitoring work that has no source event |
| Wrong choice when | The requirement says automatically | The requirement is about a dependency changing rather than your code | The base is pinned by digest, republished under a new version tag, or used only in a buildtime stage | The requirement is to rebuild at the moment a dependency changes |
Decision tree
Sharp facts the exam loves — give these one last read before exam day.
Cheat sheet
Sharp facts the exam loves — scan these before test day.
- az acr build builds in the cloud and pushes automatically
az acr build submits the build context to a quick task that builds the image on ACR-managed compute and pushes it to the registry, so no local Docker engine is required to produce and store an image.
Trap Assuming az acr build needs Docker installed on the developer machine.
6 questions test this
- Your team is about to add an automated registry task that will rebuild an embeddings service image on every commit to the main branch. Before anyone commits the reworked Dockerfile, the lead wants evi
- You build a Python API image with an ACR Tasks quick build. Before deploying the service to Azure Container Apps, the team wants to execute that image once, straight from the registry, to confirm its
- You develop a Python retrieval service whose container image installs wheels from your company's private package index. The image is built on demand in Azure Container Registry from a local context, a
- You maintain a document-ingestion worker image that developers build locally and then publish to Azure Container Registry as a separate manual step, which is regularly forgotten. The team wants a sing
- Your team builds several Python microservice images from hand-tuned multi-stage Dockerfiles on local machines. Management wants those builds moved into Azure so they run on managed compute close to th
- A developer must reproduce a bug reported against a retrieval service by building a one-off image in Azure from a local working copy. The build has to run immediately, must not leave a persistent task
- az acr task run executes a defined task on demand
az acr task run triggers an already-created task immediately, independent of its automatic triggers, which is useful for validating a task definition before wiring up commit or base-image triggers.
- az acr build takes a build context plus --file and --platform
The positional argument of az acr build is the build context, which may be a local folder (uploaded as a tarball, honoring .dockerignore), a remote Git URL such as https://github.com/org/repo.git#branch:folder, or the URL of a remote tarball; -f/--file names the Dockerfile relative to that context rather than requiring it at the context root. --platform Linux/arm64 targets an architecture other than the default Linux/amd64, and --no-push compiles the image for validation without publishing it to the repository.
Trap Assuming the Dockerfile must sit at the root of the supplied context and be named exactly Dockerfile.
7 questions test this
- Your organization hosts its source in GitLab and wants Azure Container Registry to build a service image whenever a developer pushes to the release branch. A colleague proposes creating a registry tas
- Your pull request pipeline must confirm that a proposed change to the ingestion service Dockerfile still produces a working image. The check runs on every pull request, and the resulting image must ne
- Your team maintains a legacy Windows-based batch worker alongside its Python services and needs its container image built in Azure Container Registry rather than on a local machine. The Dockerfile dec
- You develop a Python retrieval service whose container image installs wheels from your company's private package index. The image is built on demand in Azure Container Registry from a local context, a
- You build a Python inference sidecar image with an ACR Tasks quick build and deploy it to ARM64-based Azure compute. Colleagues report that the image produced by the current build refuses to start on
- A quick build of your Python service succeeds on a developer workstation but fails in Azure Container Registry. The Dockerfile runs a step that reads the repository's .git folder to stamp the commit h
- You develop a monorepo whose services share a common Python package at the repository root. The container definition for the scoring service lives in a services/scoring folder and is named scoring.Doc
- Base-image update trigger rebuilds on FROM dependency change
A base-image-update trigger tracks the image referenced in the Dockerfile FROM instruction and automatically rebuilds the dependent image whenever that base OS or runtime image is updated in the registry, enabling automated patching.
Trap Choosing a schedule trigger to react to base-image updates.
13 questions test this
- Your platform team publishes a hardened Python base image and pushes each monthly patch under a brand-new version tag such as 3.11-secure-2026-05. Application Dockerfiles are edited by hand to the new
- When the base image behind your retrieval-augmented generation API is patched, the team must rebuild the image, run a container that executes functional tests against it, and push the image only after
- An Azure Container Registry task builds your API image and tags it with the Git commit hash of the build context. After the base image is patched, the task rebuilds from that same commit and pushes an
- Your team maintains an Azure Container Registry task for a document-embedding service. The task's base image trigger is enabled and the task has already run successfully several times, but patched bas
- A regulated model-serving image must stay on the exact base image that passed validation until the compliance team approves a new one, while builds from code commits must continue for the same task. T
- Your platform team keeps one hardened Python base image in a dedicated Azure container registry in West Europe, while each application team builds its inference API image in its own registry in East U
- You create an Azure Container Registry task that builds your Python inference API image from a Dockerfile whose FROM instruction references a base image in the same registry. Your team pushes a patche
- You develop a containerized Azure Functions worker whose Dockerfile pulls its base image directly from a public Docker Hub repository. An Azure Container Registry task rebuilds the worker when that ba
- Your Azure Kubernetes Service deployment of an inference API must always pull the exact image build that was tested, yet the image must also be rebuilt automatically whenever its base runtime image re
- A team wants one Azure Container Registry task for its embedding service image to rebuild in three situations: when code is merged to the main branch, when the base image is patched in the registry, a
- A base image update starts a rebuild of your Azure Container Registry task at 02:00 and the run fails. When you rerun the task manually the next morning it succeeds, so you cannot reproduce the failur
- An Azure Container Registry task builds your retrieval service image on Git commits and on base image updates. After a nightly OS patch, a new image appears in the registry although nobody merged code
- Your release pipeline builds each image with an on-demand Azure Container Registry quick task, which builds the image in the cloud and pushes it to the registry. The security team asks that images als
- Base-image tracking follows a stable tag, not a digest
Base-image update triggers depend on the FROM instruction referencing a stable tag; if the Dockerfile pins its base image by digest, that base can never change and the trigger will never fire.
Trap Pinning the base image by digest and still expecting the base-image update trigger to fire.
5 questions test this
- Your platform team publishes a hardened Python base image and pushes each monthly patch under a brand-new version tag such as 3.11-secure-2026-05. Application Dockerfiles are edited by hand to the new
- An Azure Container Registry task builds your API image and tags it with the Git commit hash of the build context. After the base image is patched, the task rebuilds from that same commit and pushes an
- Your team maintains an Azure Container Registry task for a document-embedding service. The task's base image trigger is enabled and the task has already run successfully several times, but patched bas
- Your Azure Kubernetes Service deployment of an inference API must always pull the exact image build that was tested, yet the image must also be rebuilt automatically whenever its base runtime image re
- Your Dockerfile starts with FROM python:latest, and an Azure Container Registry task rebuilds the image whenever that tag is updated in the registry. Twice this year a rebuild moved the service onto a
- Source-commit trigger fires from a Git webhook
Creating a task with a Git context registers a webhook on the linked GitHub or Azure Repos repository and rebuilds the image on each commit to the tracked branch, because --commit-trigger-enabled defaults to True. The pull-request trigger is a separate trigger on the same context and is disabled by default until you pass --pull-request-trigger-enabled true.
Trap Expecting a commit trigger to also react to base-image updates.
9 questions test this
- You develop a Python inference API whose container image is built by an Azure Container Registry task. The image must be rebuilt and pushed automatically every time a developer merges code into the tr
- An Azure Container Registry task rebuilds your retrieval service image on every commit to the tracked branch. Compliance now requires a fresh build of the same image every night, including days when n
- Your team's Azure Container Registry task builds a model-serving image from a GitHub repository, and its context pins the release branch. Developers now merge daily work into a long-lived develop bran
- Your organization hosts its Python service code in GitHub Enterprise, and image builds must run in Azure Container Registry rather than on self-managed agents. You try to create a task with a source c
- A release freeze starts tomorrow. During the freeze, commits to the tracked GitHub branch must not produce new images in Azure Container Registry, but the security team still requires the production i
- A colleague configured an Azure Container Registry webhook that posts to a deployment service, expecting it to rebuild your agent image whenever code lands in the GitHub repository. Nothing rebuilds a
- You maintain an Azure Container Registry task that rebuilds a Python scoring image whenever code is committed to the tracked GitHub branch. The task was created with the base image update trigger turn
- An Azure Container Registry task with a source commit trigger failed during the night after a teammate pushed to the tracked branch. This morning you rerun the task manually and it succeeds, so the st
- Your team keeps its Python agent code in Azure Repos rather than GitHub, and it wants Azure Container Registry to rebuild and push the container image whenever code is committed to the tracked branch,
- Git-triggered tasks need a repository access token
Creating a source-triggered task requires a Git personal access token so ACR can set the webhook and read the source repository. The required GitHub scopes depend on visibility: repo:status plus public_repo for a public repository, and full repo control for a private one; on Azure DevOps the required scope is Code (Read).
- The --context fragment pins which branch and folder a task watches
az acr task create --context https://github.com/org/repo.git#main:src binds the definition to exactly one branch (#main) and one subfolder (:src), so a push to any other branch is ignored even though the webhook exists. az acr task list-runs --registry --name then lists past executions with their TRIGGER column (Commit, Manual, Image Update, or Timer), which is how you confirm what actually started a given run.
Trap Expecting a task pinned to main to fire when a feature branch is pushed.
7 questions test this
- An Azure Container Registry task rebuilds your retrieval service image on every commit to the tracked branch. Compliance now requires a fresh build of the same image every night, including days when n
- To make builds reproducible, a colleague created your Azure Container Registry task with a context that pins a specific commit hash in the GitHub repository. Builds now produce an identical image ever
- Your team's Azure Container Registry task builds a model-serving image from a GitHub repository, and its context pins the release branch. Developers now merge daily work into a long-lived develop bran
- Your monorepo on GitHub holds several services, and the retrieval service you own lives in a subfolder with its own Dockerfile. You create an Azure Container Registry task pinned to the main branch, a
- An unexpected image tag appears in your Azure Container Registry overnight. The registry hosts one task that has a source commit trigger on a GitHub branch, a base image update trigger, and a nightly
- Your Azure Container Registry task has built an embedding service image on every commit for months. After a repository restructure, the team retires the branch the task was created against and merges
- An Azure Container Registry task with a source commit trigger failed during the night after a teammate pushed to the tracked branch. This morning you rerun the task manually and it succeeds, so the st
- Timer trigger runs a task on a cron schedule
A scheduled (timer) trigger runs the task on a fixed cron schedule regardless of source or base-image changes, which suits periodic rebuilds or a recurring purge job but cannot guarantee a rebuild at the moment a dependency changes.
Trap Using a schedule trigger when the requirement is to rebuild exactly when a base image changes.
8 questions test this
- A multi-step acr-task.yaml file that builds, tests, and pushes your Python service image is run on demand today. Management wants the full workflow to run every night at a fixed hour with nobody signe
- You have just created a task in Azure Container Registry that runs a maintenance container on a daily timer trigger. Before you leave the change in place, you must confirm that the task definition act
- You operate a shared Azure Container Registry for a Python AI platform team. Continuous integration pushes dozens of build tags every day, and storage growth is now a cost concern. The registry must b
- Your team maintains a Python inference image whose Dockerfile references a hardened base image stored in the same Azure Container Registry. A nightly timer-triggered task currently rebuilds the infere
- You support a production Python API image that is already deployed from Azure Container Registry. Site reliability engineers want a containerized smoke test executed against that production image at r
- A Python microservice image is rebuilt every night by a timer-triggered task in Azure Container Registry. Developers merge to the main branch several times a day and complain that a merged fix waits u
- A registry maintenance container in Azure Container Registry must run twice a day, early in the morning and again in the middle of the afternoon, and the two runs are not evenly spaced. Operations wan
- Your team in Berlin creates a task in Azure Container Registry that rebuilds a Python service image every night. The cron expression was written for the intended local time, but the run history shows
- Multi-step tasks define build, push, and cmd steps in YAML
A multi-step task uses an acr-task.yaml file to run ordered build, push, and cmd steps (for example build the image, run tests, then push) within a single task execution.
8 questions test this
- A multi-step acr-task.yaml file that builds, tests, and pushes your Python service image is run on demand today. Management wants the full workflow to run every night at a fixed hour with nobody signe
- A multi-step task in Azure Container Registry starts a Python API container in a detached cmd step and then runs a separate test container in a later cmd step. The test container must send HTTP reques
- A multi-step task in Azure Container Registry builds a Python application image and a separate test-runner image. The test-runner image is used only inside the task run to exercise the application, an
- You support a production Python API image that is already deployed from Azure Container Registry. Site reliability engineers want a containerized smoke test executed against that production image at r
- Your team builds a Python API container image in Azure Container Registry. A containerized functional test suite must run against the newly built image, and the image must reach the registry only when
- A developer converts a single-image build into a multi-step task defined in an acr-task.yaml file that contains a build step and a cmd step running unit tests. The run finishes successfully and the lo
- A multi-step task in Azure Container Registry builds an application image and an independent test-tooling image, then pushes both. The two builds do not depend on each other, yet the run takes far lon
- In a multi-step task in Azure Container Registry, one cmd step runs a Python test container that writes a coverage report file, and a later cmd step runs a different container that must read that repo
References
- Automate container builds with Azure Container Registry Tasks
- Tutorial: build container images in the cloud with Azure Container Registry Tasks
- Azure Container Registry frequently asked questions FAQ
- az acr command reference (az acr build)
- az acr task command reference (az acr task create)
- Tutorial: automate container image builds on a source-code commit
- About base image updates for Azure Container Registry Tasks
- Tutorial: automate image builds on base image update in an Azure container registry
- Recommendations for tagging and versioning container images
- Run an Azure Container Registry task on a defined schedule
- YAML reference for Azure Container Registry Tasks
- Run a multi-step container workflow with Azure Container Registry Tasks
- Use a managed identity in an Azure Container Registry task