✦ For everyone, free.

Practical knowledge for real and everyday life

Home

10.3.3.4 ACR Task Automation

A focused guide to ACR Task Automation, connecting core concepts with practical Docker and container operations.

ACR Task automation allows Azure Container Registry to automatically build and push an image directly within Azure, triggered by events like a source code commit or a base image update, without requiring a separately hosted build environment.

Defining a Task Triggered by a Source Code Commit

A task connects a source repository to a build definition, automatically triggering a new build whenever relevant changes occur.

az acr task create --registry myacrregistry --name build-myapp \
  --image myapp:{{.Run.ID}} \
  --context https://github.com/myorg/myapp.git \
  --file Dockerfile \
  --git-access-token <token>

This task automatically builds and pushes a new image to myacrregistry whenever the configured trigger (commits to the connected repository, by default) occurs.

Triggering a Task Manually

A defined task can also be run on demand, independent of its configured automatic triggers.

az acr task run --registry myacrregistry --name build-myapp
Triggering a Rebuild When a Base Image Updates

ACR Tasks can also detect when a base image referenced in the Dockerfile has been updated, automatically triggering a rebuild to pick up that update, even without any change to the application's own source code.

FROM node:20-alpine

A task configured this way automatically rebuilds and pushes a fresh image whenever a new node:20-alpine build becomes available, helping keep the application's base layer current with security patches.

Why This Removes the Need for a Separately Hosted Build System

Without this capability, achieving the same automatic build-on-commit or build-on-base-update behavior would require a separately configured CI system — ACR Tasks provides this directly within the registry service itself.

az acr task list --registry myacrregistry
Why ACR Task Automation Matters

This built-in build automation simplifies maintaining up-to-date images without necessarily requiring a separate, independently managed CI/CD pipeline just for triggering rebuilds in response to source or base image changes.