Azure CLI ACR Command Module
raw JSON → 2.2.9 verified Sat May 09 auth: no python
Microsoft Azure Command-Line Tools ACR Command Module. Manages Azure Container Registry resources including registries, repositories, tasks, and tokens. Part of the Azure CLI. Version 2.2.9. Release cadence tied to Azure CLI releases (approximately monthly).
pip install azure-cli-acr Common errors
error ResourceNotFoundError: The Resource 'Microsoft.ContainerRegistry/registries/<name>' under resource group '<rg>' was not found. ↓
cause Incorrect resource group or registry name, or registry not deployed.
fix
Verify the registry name and resource group using
az acr list --query "[].{name:name, resourceGroup:resourceGroup}". error The command is not recognized. Please validate it is available. ↓
cause The azure-cli-acr extension is not installed or loaded.
fix
Run
az extension add --name acr or install via pip install azure-cli-acr. Then restart the CLI. error error: unrecognized arguments: --<param> ↓
cause Using an outdated parameter name (e.g., `--registry-name` instead of `--name`).
fix
Check the correct parameters with
az acr <command> --help. error Login failed: AADSTS700016 ↓
cause Application with identifier was not found in the directory. Possibly the Azure CLI is not logged in or has a stale token.
fix
Run
az login to re-authenticate and ensure you have the correct subscription az account set --subscription <id>. Warnings
breaking The `az acr build` command with legacy parameters (e.g., `--dockerfile`) was refactored. Use `az acr task run` instead. ↓
fix Use `az acr task create` and `az acr task run` to execute builds.
deprecated The `--resource-group` parameter is being phased out in favor of `--resource-group`. Actually, `--resource-group` is required for most ACR commands but its omission is a common source of errors. ↓
fix Always specify `--resource-group <name>` unless the command documentation explicitly says it's optional.
gotcha When using `az acr import`, the source image must be in the format `registry.azurecr.io/repo:tag`. Omitting the full qualified name results in a `RegistryNotFound` error. ↓
fix Use `az acr import --source <registry>.azurecr.io/<repo>:<tag>`.
Install
az extension add --name acr Imports
- acr_commands
from azure.cli.command_modules.acr import acr_commands - custom wrong
from azure.cli.command_modules.acr import customcorrectfrom azure.cli.command_modules.acr.custom import *
Quickstart
import os
from azure.cli.core import get_default_cli
cli = get_default_cli()
exit_code = cli.invoke(['acr', 'list', '--output', 'json'])
if exit_code != 0:
print('List failed')
else:
import json
registries = json.loads(cli.result.result)
print(json.dumps(registries, indent=2))