github/awesome-copilot / skills/azure-container-registry-cli
azure-container-registry-cli
FlaggedManage Azure Container Registry via the az acr CLI including registries, images, cloud builds, ACR Tasks, authentication, tokens, geo-replication, and networking. Use when working with ACR, az acr commands, pushing/importing/purging container images in Azure, or when the user mentions Azure Container Registry.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 5.0 KB |
| references/auth-and-security.md | markdown | 7.5 KB |
| references/build-and-tasks.md | markdown | 6.0 KB |
| references/images-and-artifacts.md | markdown | 6.4 KB |
| references/networking-and-geo.md | markdown | 6.8 KB |
references/build-and-tasks.md
View on GitHub# Builds & ACR Tasks
## Table of Contents
- [Quick Build (az acr build)](#quick-build-az-acr-build)
- [Run a Command or Multi-Step Task Once (az acr run)](#run-a-command-or-multi-step-task-once-az-acr-run)
- [ACR Tasks (az acr task)](#acr-tasks-az-acr-task)
- [Triggers](#triggers)
- [Multi-Step Task YAML](#multi-step-task-yaml)
- [Agent Pools](#agent-pools)
---
## Quick Build (az acr build)
Builds in Azure and pushes to the registry — no local Docker daemon required:
```bash
# Build from the current directory and push
az acr build --registry {registry} --image app:v1 .
# Custom Dockerfile, build args, target platform
az acr build --registry {registry} --image app:v1 \
--file docker/Dockerfile.prod \
--build-arg VERSION=1.2.3 \
--platform linux/amd64 .
# Cross-platform: each build produces ONE single-architecture image for the target platform
az acr build --registry {registry} --image app:v1-arm64 --platform linux/arm64 .
# For a true multi-arch image, build once per platform under arch-specific tags, then
# assemble and push a manifest list (docker manifest create/push, or docker buildx locally)
# Build directly from a Git repo (no local clone)
az acr build --registry {registry} --image app:v1 https://github.com/{org}/{repo}.git#{branch}:{folder}
# Build without pushing (validation only)
az acr build --registry {registry} --image app:test --no-push .
```
Notes:
- The build context is uploaded; use a `.dockerignore` to keep it small.
- Tag with a unique value per build (git SHA, run ID) — avoid relying on `latest`.
## Run a Command or Multi-Step Task Once (az acr run)
```bash
# Run a container command in the registry's task runner (context /dev/null = no upload)
az acr run --registry {registry} --cmd '{registry}.azurecr.io/app:v1' /dev/null
# Execute a multi-step task file against the current directory
az acr run --registry {registry} --file acb.yaml .
```
## ACR Tasks (az acr task)
Persistent, triggerable build definitions:
```bash
# Create a task that builds on every commit to main
az acr task create --registry {registry} --name build-app \
--image "app:{{.Run.ID}}" \
--context https://github.com/{org}/{repo}.git#main \
--file Dockerfile \
--git-access-token {pat} \
--commit-trigger-enabled true \
--base-image-trigger-enabled true
# Manually trigger, list, inspect
az acr task run --registry {registry} --name build-app
az acr task list --registry {registry} --output table
az acr task list-runs --registry {registry} --name build-app --output table
az acr task logs --registry {registry} --name build-app # latest run
az acr task logs --registry {registry} --run-id {run-id}
# Update / disable / delete
az acr task update --registry {registry} --name build-app --image "app:{{.Run.ID}}"
az acr task update --registry {registry} --name build-app --status Disabled
az acr task delete --registry {registry} --name build-app --yes
```
Useful run variables for `--image`: `{{.Run.ID}}`, `{{.Run.Commit}}`, `{{.Run.Branch}}`, `{{.Run.Date}}`.
⚠️ On **ABAC-enabled registries** (`roleAssignmentMode` = `AbacRepositoryPermissions`), tasks and quick builds/runs have no default access to the source registry. Pass `--source-acr-auth-id [caller]` to `az acr build`/`az acr run`, and `--source-acr-auth-id [system]` (or a user-assigned identity resource ID) to `az acr task create`/`update`, then grant that identity the `Container Registry Repository ...` roles. Ensure the task actually has that identity — add `--assign-identity [system]` at creation, or run `az acr task identity assign` on an existing task, before referencing it.
## Triggers
```bash
# Timer trigger (cron in UTC) — e.g., nightly rebuild
az acr task timer add --registry {registry} --name build-app \
--timer-name nightly --schedule "0 2 * * *"
az acr task timer list --registry {registry} --name build-app
az acr task timer remove --registry {registry} --name build-app --timer-name nightly
```
- **Commit trigger**: rebuild on push to the tracked branch (`--commit-trigger-enabled`).
- **Base image trigger**: rebuild automatically when the base image (e.g., a patched `mcr.microsoft.com` image) is updated (`--base-image-trigger-enabled`) — key for OS/framework patching.
- **Timer trigger**: cron schedules; also the standard way to schedule `acr purge` cleanup (see `images-and-artifacts.md`).
Tasks that access other registries or Azure resources can use an identity:
```bash
az acr task identity assign --registry {registry} --name build-app # system-assigned
az acr task credential add --registry {registry} --name build-app \
--login-server {other-registry}.azurecr.io --use-identity [system]
```
## Multi-Step Task YAML
`acb.yaml` — build, test, then push only on success:
```yaml
version: v1.1.0
steps:
- build: -t $Registry/app:{{.Run.ID}} -f Dockerfile .
- cmd: $Registry/app:{{.Run.ID}} run-tests
- push:
- $Registry/app:{{.Run.ID}}
```
```bash
# Run once
az acr run --registry {registry} --file acb.yaml .
# Or create a triggered task from the YAML
az acr task create --registry {registry} --name build-test-push \
--file acb.yaml \
--context https://github.com/{org}/{repo}.git#main \
--git-access-token {pat}
```
## Agent Pools
Premium SKU. Dedicated task compute — for more CPU, or one of the two supported ways to run tasks against a network-restricted registry (the other being trusted services + the task network bypass policy, see `networking-and-geo.md`):
```bash
az acr agentpool create --registry {registry} --name pool1 --tier S2 # S1/S2/S3/I6
# For the firewall/VNet scenario, the pool MUST be attached to a subnet that can
# reach the registry's private endpoint — without --subnet-id it runs outside the VNet
az acr agentpool create --registry {registry} --name pool1 --tier S2 \
--subnet-id /subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.Network/virtualNetworks/{vnet}/subnets/{subnet}
az acr agentpool list --registry {registry} --output table
# Target the pool
az acr build --registry {registry} --agent-pool pool1 --image app:v1 .
az acr task create --registry {registry} --name build-app --agent-pool pool1 ...
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |