az acr

Manage private registries with Azure Container Registries.

Commands

az acr build Queues a quick build, providing streaming logs for an Azure Container Registry.
az acr check-health Gets health information on the environment and optionally a target registry.
az acr check-name Checks if an Azure Container Registry name is valid and available for use.
az acr config Configure policies for Azure Container Registries.
az acr config content-trust Manage content-trust policy for Azure Container Registries.
az acr config content-trust show Show the configured content-trust policy for an Azure Container Registry.
az acr config content-trust update Update content-trust policy for an Azure Container Registry.
az acr config retention Manage retention policy for Azure Container Registries.
az acr config retention show Show the configured retention policy for an Azure Container Registry.
az acr config retention update Update retention policy for an Azure Container Registry.
az acr create Creates an Azure Container Registry.
az acr credential Manage login credentials for Azure Container Registries.
az acr credential renew Regenerate login credentials for an Azure Container Registry.
az acr credential show Get the login credentials for an Azure Container Registry.
az acr delete Deletes an Azure Container Registry.
az acr helm Manage helm charts for Azure Container Registries.
az acr helm delete Delete a helm chart version in an Azure Container Registry.
az acr helm list List all helm charts in an Azure Container Registry.
az acr helm push Push a helm chart package to an Azure Container Registry.
az acr helm repo Manage helm chart repositories for Azure Container Registries.
az acr helm repo add Add a helm chart repository from an Azure Container Registry through the Helm CLI.
az acr helm show Describe a helm chart in an Azure Container Registry.
az acr import Imports an image to an Azure Container Registry from another Container Registry. Import removes the need to docker pull, docker tag, docker push.
az acr list Lists all the container registries under the current subscription.
az acr login Log in to an Azure Container Registry through the Docker CLI.
az acr network-rule Manage network rules for Azure Container Registries.
az acr network-rule add Add a network rule.
az acr network-rule list List network rules.
az acr network-rule remove Remove a network rule.
az acr pack Manage Azure Container Registry Tasks that use Cloud Native Buildpacks.
az acr pack build Queues a quick build task that builds an app and pushes it into an Azure Container Registry.
az acr replication Manage geo-replicated regions of Azure Container Registries.
az acr replication create Create a replicated region for an Azure Container Registry.
az acr replication delete Delete a replicated region from an Azure Container Registry.
az acr replication list List all of the regions for a geo-replicated Azure Container Registry.
az acr replication show Get the details of a replicated region.
az acr replication update Updates a replication.
az acr repository Manage repositories (image names) for Azure Container Registries.
az acr repository delete Delete a repository or image in an Azure Container Registry.
az acr repository list List repositories in an Azure Container Registry.
az acr repository show Get the attributes of a repository or image in an Azure Container Registry.
az acr repository show-manifests Show manifests of a repository in an Azure Container Registry.
az acr repository show-tags Show tags for a repository in an Azure Container Registry.
az acr repository untag Untag an image in an Azure Container Registry.
az acr repository update Update the attributes of a repository or image in an Azure Container Registry.
az acr run Queues a quick run providing streamed logs for an Azure Container Registry.
az acr scope-map Manage scope access maps for Azure Container Registries.
az acr scope-map create Create a scope map for an Azure Container Registry.
az acr scope-map delete Delete a scope map for an Azure Container Registry.
az acr scope-map list List all scope maps for an Azure Container Registry.
az acr scope-map show Show details and attributes of a scope map for an Azure Container Registry.
az acr scope-map update Update a scope map for an Azure Container Registry.
az acr show Get the details of an Azure Container Registry.
az acr show-usage Get the storage usage for an Azure Container Registry.
az acr task Manage a collection of steps for building, testing and OS & Framework patching container images using Azure Container Registries.
az acr task cancel-run Cancel a specified run of an Azure Container Registry.
az acr task create Creates a series of steps for building, testing and OS & Framework patching containers. Tasks support triggers from git commits and base image updates.
az acr task credential Manage credentials for a task. Please see <a href="https://aka.ms/acr/tasks/cross-registry-authentication">https://aka.ms/acr/tasks/cross-registry-authentication</a> for more information.
az acr task credential add Add a custom registry login credential to the task.
az acr task credential list List all the custom registry credentials for task.
az acr task credential remove Remove credential for a task.
az acr task credential update Update the registry login credential for a task.
az acr task delete Delete a task from an Azure Container Registry.
az acr task identity Managed Identities for Task. Please see <a href="https://aka.ms/acr/tasks/task-create-managed-identity">https://aka.ms/acr/tasks/task-create-managed-identity</a> for more information.
az acr task identity assign Update the managed identity for a task.
az acr task identity remove Remove managed identities for a task.
az acr task identity show Display the managed identities for task.
az acr task list List the tasks for an Azure Container Registry.
az acr task list-runs List all of the executed runs for an Azure Container Registry, with the ability to filter by a specific Task.
az acr task logs Show logs for a particular run. If no run-id is supplied, show logs for the last created run.
az acr task run Manually trigger a task that might otherwise be waiting for git commits or base image update triggers.
az acr task show Get the properties of a named task for an Azure Container Registry.
az acr task show-run Get the properties of a specified run of an Azure Container Registry Task.
az acr task timer Manage timer triggers for a task.
az acr task timer add Add a timer trigger to a task.
az acr task timer list List all timer triggers for a task.
az acr task timer remove Remove a timer trigger from a task.
az acr task timer update Update the timer trigger for a task.
az acr task update Update a task for an Azure Container Registry.
az acr task update-run Patch the run properties of an Azure Container Registry Task.
az acr token Manage tokens for an Azure Container Registry.
az acr token create Create a token associated with a scope map for an Azure Container Registry.
az acr token credential Manage credentials of a token for an Azure Container Registry.
az acr token credential delete Delete a token credential.
az acr token credential generate Generate or replace one or both passwords of a token for an Azure Container Registry. For using token and password to access a container registry, see <a href="https://aka.ms/acr/repo-permissions">https://aka.ms/acr/repo-permissions</a>.
az acr token delete Delete a token for an Azure Container Registry.
az acr token list List all tokens for an Azure Container Registry.
az acr token show Show details and attributes of a token for an Azure Container Registry.
az acr token update Update a token (replace associated scope map) for an Azure Container Registry.
az acr update Update an Azure Container Registry.
az acr webhook Manage webhooks for Azure Container Registries.
az acr webhook create Create a webhook for an Azure Container Registry.
az acr webhook delete Delete a webhook from an Azure Container Registry.
az acr webhook get-config Get the service URI and custom headers for the webhook.
az acr webhook list List all of the webhooks for an Azure Container Registry.
az acr webhook list-events List recent events for a webhook.
az acr webhook ping Trigger a ping event for a webhook.
az acr webhook show Get the details of a webhook.
az acr webhook update Update a webhook.

az acr build

Queues a quick build, providing streaming logs for an Azure Container Registry.

az acr build --registry
[--auth-mode {Default, None}]
[--build-arg]
[--file]
[--image]
[--no-format]
[--no-logs]
[--no-push]
[--no-wait]
[--platform]
[--resource-group]
[--secret-build-arg]
[--subscription]
[--target]
[--timeout]
[]

Examples

Queue a local context as a Linux build, tag it, and push it to the registry.

az acr build -t sample/hello-world:{{.Run.ID}} -r MyRegistry .

Queue a local context as a Linux build, tag it, and push it to the registry without streaming logs.

az acr build -t sample/hello-world:{{.Run.ID}} -r MyRegistry --no-logs .

Queue a local context as a Linux build without pushing it to the registry.

az acr build -t sample/hello-world:{{.Run.ID}} -r MyRegistry --no-push .

Queue a local context as a Linux build without pushing it to the registry.

az acr build -r MyRegistry .

Queue a remote GitHub context as a Windows build, tag it, and push it to the registry.

az acr build -r MyRegistry https://github.com/Azure/acr-builder.git -f Windows.Dockerfile --platform windows

Queue a local context as a Linux build on arm/v7 architecture, tag it, and push it to the registry.

az acr build -t sample/hello-world:{{.Run.ID}} -r MyRegistry . --platform linux/arm/v7

Required Parameters

--registry -r

The name of the container registry. You can configure the default registry name using az configure --defaults acr=<registry name>.

Optional Parameters

--auth-mode

Auth mode of the source registry.

accepted values: Default, None
--build-arg

Build argument in '--build-arg name[=value]' format. Multiples supported by passing --build-arg multiple times.

--file -f

The relative path of the the docker file to the source code root folder. Default to 'Dockerfile'.

--image -t

The name and tag of the image using the format: '-t repo/image:tag'. Multiple tags are supported by passing -t multiple times.

--no-format

Indicates whether the logs should be displayed in raw format.

--no-logs

Do not show logs after successfully queuing the build.

--no-push

Indicates whether the image built should be pushed to the registry.

--no-wait

Do not wait for the build to complete and return immediately after queuing the build.

--platform

The platform where build/task is run, Eg, 'windows' and 'linux'. When it's used in build commands, it also can be specified in 'os/arch/variant' format for the resulting image. Eg, linux/arm/v7. The 'arch' and 'variant' parts are optional.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--secret-build-arg

Secret build argument in '--secret-build-arg name[=value]' format. Multiples supported by passing '--secret-build-arg name[=value]' multiple times.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--target

The name of the target build stage.

--timeout

The timeout in seconds.

<SOURCE_LOCATION>

The local source code directory path (e.g., './src') or the URL to a git repository (e.g., 'https://github.com/Azure-Samples/acr-build-helloworld-node.git') or a remote tarball (e.g., 'http://server/context.tar.gz').

az acr check-health

Gets health information on the environment and optionally a target registry.

az acr check-health [--ignore-errors]
[--name]
[--subscription]
[--yes]

Examples

Gets health state with target registry 'MyRegistry', skipping confirmation for pulling image.

az acr check-health -n MyRegistry -y

Gets health state of the environment, without stopping on first error.

az acr check-health --ignore-errors

Optional Parameters

--ignore-errors

Provide all health checks, even if errors are found.

--name -n

The name of the container registry. You can configure the default registry name using az configure --defaults acr=<registry name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--yes -y

Do not prompt for confirmation.

az acr check-name

Checks if an Azure Container Registry name is valid and available for use.

az acr check-name --name
[--subscription]

Examples

Check if a registry name already exists.

az acr check-name -n doesthisnameexist

Required Parameters

--name -n

The name of the container registry. You can configure the default registry name using az configure --defaults acr=<registry name>.

Optional Parameters

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az acr create

Creates an Azure Container Registry.

az acr create --name
--resource-group
--sku {Basic, Classic, Premium, Standard}
[--admin-enabled {false, true}]
[--default-action {Allow, Deny}]
[--location]
[--subscription]
[--tags]
[--workspace]

Examples

Create a managed container registry with the Standard SKU.

az acr create -n MyRegistry -g MyResourceGroup --sku Standard

Required Parameters

--name -n

The name of the container registry. You can configure the default registry name using az configure --defaults acr=<registry name>.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--sku

The SKU of the container registry.

accepted values: Basic, Classic, Premium, Standard

Optional Parameters

--admin-enabled

Indicates whether the admin user is enabled.

accepted values: false, true
--default-action

Default action to apply when no rule matches. Only applicable to Premium SKU.

accepted values: Allow, Deny
--location -l

Location. Values from: az account list-locations. You can configure the default location using az configure --defaults location=<location>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--tags

Space-separated tags in 'key[=value]' format. Use "" to clear existing tags.

--workspace

Name or ID of the Log Analytics workspace to send registry diagnostic logs to. All events will be enabled. You can use "az monitor log-analytics workspace create" to create one. Extra billing may apply.

az acr delete

Deletes an Azure Container Registry.

az acr delete --name
[--resource-group]
[--subscription]

Examples

Delete an Azure Container Registry.

az acr delete -n MyRegistry

Required Parameters

--name -n

The name of the container registry. You can configure the default registry name using az configure --defaults acr=<registry name>.

Optional Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az acr import

Imports an image to an Azure Container Registry from another Container Registry. Import removes the need to docker pull, docker tag, docker push.

az acr import --name
--source
[--force]
[--image]
[--password]
[--registry]
[--repository]
[--resource-group]
[--subscription]
[--username]

Examples

Import an image to the target registry and inherits sourcerepository:sourcetag from the source registry.

az acr import -n MyRegistry --source sourceregistry.azurecr.io/sourcerepository:sourcetag

Import an image from a registry in a different subscription.

az acr import -n MyRegistry --source sourcerepository:sourcetag -t targetrepository:targettag \
    -r /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/sourceResourceGroup/providers/Microsoft.ContainerRegistry/registries/sourceRegistry

Import an image from a public repository in Docker Hub

az acr import -n MyRegistry --source docker.io/library/hello-world:latest -t targetrepository:targettag

Required Parameters

--name -n

The name of the container registry. You can configure the default registry name using az configure --defaults acr=<registry name>.

--source

The source identifier will be either a source image name or a fully qualified source.

Optional Parameters

--force

Overwrite the existing tag of the image to be imported.

--image -t

The name and tag of the image using the format: '-t repo/image:tag'. Multiple tags are supported by passing -t multiple times.

--password -p

The password of source container registry.

--registry -r

The source container registry can be name, login server or resource ID of the source registry.

--repository

The repository name for a manifest-only copy of images. Multiple copies supported by passing --repository multiple times.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--username -u

The username of source container registry.

az acr list

Lists all the container registries under the current subscription.

az acr list [--resource-group]
[--subscription]

Examples

List container registries and show the results in a table, across multiple resource groups.

az acr list -o table

List container registries in a resource group and show the results in a table.

az acr list -g MyResourceGroup -o table

Optional Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az acr login

Log in to an Azure Container Registry through the Docker CLI.

az acr login --name
[--password]
[--resource-group]
[--subscription]
[--suffix]
[--username]

Examples

Log in to an Azure Container Registry

az acr login -n MyRegistry

Required Parameters

--name -n

The name of the container registry. You can configure the default registry name using az configure --defaults acr=<registry name>.

Optional Parameters

--password -p

The password used to log into a container registry.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--suffix

The tenant suffix in registry login server. You may specify '--suffix tenant' if your registry login server is in the format 'registry-tenant.azurecr.io'. Applicable if you're accessing the registry from a different subscription or you have permission to access images but not the permission to manage the registry resource.

--username -u

The username used to log into a container registry.

az acr run

Queues a quick run providing streamed logs for an Azure Container Registry.

az acr run --registry
[--auth-mode {Default, None}]
[--cmd]
[--file]
[--no-format]
[--no-logs]
[--no-wait]
[--platform]
[--resource-group]
[--set]
[--set-secret]
[--subscription]
[--timeout]
[--values]
[]

Examples

Queue a run to execute a container command.

az acr run -r MyRegistry --cmd MyImage /dev/null

Queue a run with the task definition from the standard input. Either 'Ctrl + Z'(Windows) or 'Ctrl + D'(Linux) terminates the input stream.

az acr run -r MyRegistry -f - /dev/null

Queue a run to execute the tasks passed through the pipe.

cat task.yaml | az acr run -r MyRegistry -f - /dev/null

Queue a local context, pushed to ACR with streaming logs.

az acr run -r MyRegistry -f bash-echo.yaml .

Queue a remote git context with streaming logs.

az acr run -r MyRegistry https://github.com/Azure-Samples/acr-tasks.git -f hello-world.yaml

Queue a remote git context with streaming logs and runs the task on Linux platform.

az acr run -r MyRegistry https://github.com/Azure-Samples/acr-tasks.git -f build-hello-world.yaml --platform linux

Required Parameters

--registry -r

The name of the container registry. You can configure the default registry name using az configure --defaults acr=<registry name>.

Optional Parameters

--auth-mode

Auth mode of the source registry.

accepted values: Default, None
--cmd

Commands to execute.

--file -f

The task template/definition file path relative to the source context. It can be '-' to pipe a file from the standard input.

--no-format

Indicates whether the logs should be displayed in raw format.

--no-logs

Do not show logs after successfully queuing the build.

--no-wait

Do not wait for the run to complete and return immediately after queuing the run.

--platform

The platform where build/task is run, Eg, 'windows' and 'linux'. When it's used in build commands, it also can be specified in 'os/arch/variant' format for the resulting image. Eg, linux/arm/v7. The 'arch' and 'variant' parts are optional.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--set

Value in 'name[=value]' format. Multiples supported by passing --set multiple times.

--set-secret

Secret value in '--set name[=value]' format. Multiples supported by passing --set multiple times.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--timeout

The timeout in seconds.

--values

The task values file path relative to the source context.

<SOURCE_LOCATION>

The local source code directory path (e.g., './src') or the URL to a git repository (e.g., 'https://github.com/Azure-Samples/acr-build-helloworld-node.git') or a remote tarball (e.g., 'http://server/context.tar.gz'). If '/dev/null' is specified, the value will be set to None and ignored.

az acr show

Get the details of an Azure Container Registry.

az acr show --name
[--resource-group]
[--subscription]

Examples

Get the login server for an Azure Container Registry.

az acr show -n MyRegistry --query loginServer

Get the details of an Azure Container Registry

az acr show --name MyRegistry --resource-group MyResourceGroup

Required Parameters

--name -n

The name of the container registry. You can configure the default registry name using az configure --defaults acr=<registry name>.

Optional Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az acr show-usage

Get the storage usage for an Azure Container Registry.

az acr show-usage --name
[--resource-group]
[--subscription]

Examples

Get the storage usage for an Azure Container Registry.

az acr show-usage -n MyRegistry

Required Parameters

--name -n

The name of the container registry. You can configure the default registry name using az configure --defaults acr=<registry name>.

Optional Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az acr update

Update an Azure Container Registry.

az acr update --name
[--add]
[--admin-enabled {false, true}]
[--default-action {Allow, Deny}]
[--force-string]
[--remove]
[--resource-group]
[--set]
[--sku {Basic, Classic, Premium, Standard}]
[--subscription]
[--tags]

Examples

Update tags for an Azure Container Registry.

az acr update -n MyRegistry --tags key1=value1 key2=value2

Enable the administrator user account for an Azure Container Registry.

az acr update -n MyRegistry --admin-enabled true

Required Parameters

--name -n

The name of the container registry. You can configure the default registry name using az configure --defaults acr=<registry name>.

Optional Parameters

--add

Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.

--admin-enabled

Indicates whether the admin user is enabled.

accepted values: false, true
--default-action

Default action to apply when no rule matches. Only applicable to Premium SKU.

accepted values: Allow, Deny
--force-string

When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.

--remove

Remove a property or an element from a list. Example: --remove property.list OR --remove propertyToRemove.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--set

Update an object by specifying a property path and value to set. Example: --set property1.property2=.

--sku

The SKU of the container registry.

accepted values: Basic, Classic, Premium, Standard
--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--tags

Space-separated tags in 'key[=value]' format. Use "" to clear existing tags.