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-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 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 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 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.
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 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 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 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]
[--os]
[--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 and x86 architecture, 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/x86

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 'name[=value]' format.

--file -f

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

--image -t

The name of the image. May include a tag in the format 'name:tag'.

--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.

--os

The operating system type required for 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 'name[=value]' format.

--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-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]
[--storage-account-name]
[--subscription]

Examples

Create a managed container registry with the Standard SKU.

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

Create an Azure Container Registry with a new storage account with the Classic SKU (Classic registries are being deprecated by March 2019).

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

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>.

--storage-account-name

Provide the name of an existing storage account if you're recreating a container registry over a previous registry created storage account. Only applicable to Classic SKU.

--subscription

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

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 of the image. May include a tag in the format 'name:tag'.

--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 to do a manifest-only copy for images.

--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}]
[--file]
[--no-format]
[--no-logs]
[--no-wait]
[--os]
[--platform]
[--resource-group]
[--set]
[--set-secret]
[--subscription]
[--timeout]
[--values]
[]

Examples

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
--file -f

The task template/definition file path relative to the source context.

default value: acb.yaml
--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.

--os

The operating system type required for 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>.

--set

Value in 'name[=value]' format.

--set-secret

Secret value in 'name[=value]' format.

--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').

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}]
[--storage-account-name]
[--subscription]
[--tags]

Examples

Update tags for an Azure Container Registry.

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

Update the storage account for an Azure Container Registry (Classic Registries are being deprecated as of March 2019).

az acr update -n MyRegistry --storage-account-name MyStorageAccount

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
--storage-account-name

Provide the name of an existing storage account if you're recreating a container registry over a previous registry created storage account. Only applicable to Classic SKU.

--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.