> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# circleci/azure-acr

Easily build images and push them to the Azure Container Registry.


## Commands

### acr-login

Authenticate into Azure Container Registry service

| Parameter | Type | Default | Description |
|---|---|---|---|
| `registry-name` | string | REGISTRY_NAME | Name of env var storing your registry name, defaults to REGISTRY_NAME
 |

### build-and-push-image

Install Azure CLI, if needed, and configure. Log into ACR and push image to repository.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `alternate-tenant` | boolean | false | Use an alternate tenant. Only applicable for user logins. |
| `attach-workspace` | boolean | false | Boolean for whether or not to attach to an existing workspace. Default is false.
 |
| `azure-password` | env_var_name | AZURE_PASSWORD | Environment variable storing your Azure password. Only applicable for
user logins.
 |
| `azure-sp` | env_var_name | AZURE_SP | Name of environment variable storing the full name of the Service
Principal, in the form http://app-url. Only applicable for Service
Principal logins.
 |
| `azure-sp-password` | env_var_name | AZURE_SP_PASSWORD | Name of environment variable storing the password for the Service
Principal. Only applicable for Service Principal logins.
 |
| `azure-sp-tenant` | env_var_name | AZURE_SP_TENANT | Name of environment variable storing the tenant ID for the Service
Principal. Only applicable for Service Principal logins.
 |
| `azure-tenant` | env_var_name | AZURE_TENANT | Environment variable storing your Azure tenant, necessary if
`alternate-tenant` is set to true. Only applicable for user logins.
 |
| `azure-username` | env_var_name | AZURE_USERNAME | Environment variable storing your Azure username. Only applicable for
user logins.
 |
| `checkout` | boolean | true | Boolean for whether or not to checkout as a first step. Default is true.
 |
| `dockerfile` | string | Dockerfile | Name of dockerfile to use. Defaults to Dockerfile. |
| `executor` | executor | default | executor to use for this job |
| `extra-build-args` | string |  | Extra flags to pass to docker build. For examples, see https://docs.docker.com/engine/reference/commandline/build
 |
| `lint-dockerfile` | boolean | false | Lint Dockerfile before building?
 |
| `login-server-name` | string |  | The Azure login server for your ACR instance, e.g. {yourregistryname}.azure.io
 |
| `path` | string | . | Path to the directory containing your Dockerfile and build context. Defaults to . (working directory).
 |
| `registry-name` | string |  | The name of your ACR registry |
| `repo` | string |  | Name of an ACR repository |
| `tag` | string | latest | Comma-delimited string containing docker image tags (default = latest) |
| `treat-warnings-as-errors` | boolean | false | If linting Dockerfile, treat linting warnings as errors (would trigger an exist code and fail the CircleCI job)?
 |
| `workspace-root` | string | . | Workspace root path that is either an absolute path or a path relative to the working directory. Defaults to '.' (the working directory)
 |

## Jobs

### build-and-push-image

Install Azure CLI, if needed, and configure. Log into ACR and push image to repository. Requires environment variables for . We recommend these be saved in a Project (https://circleci.com/docs/2.0/env-vars/#setting-an-environment-variable-in-a-project) or in Contexts (https://circleci.com/docs/2.0/contexts).


| Parameter | Type | Default | Description |
|---|---|---|---|
| `alternate-tenant` | boolean | false | Use an alternate tenant. Only applicable for user logins. |
| `attach-workspace` | boolean | false | Boolean for whether or not to attach to an existing workspace. Default is false.
 |
| `azure-password` | env_var_name | AZURE_PASSWORD | Environment variable storing your Azure password. Only applicable for
user logins.
 |
| `azure-sp` | env_var_name | AZURE_SP | Name of environment variable storing the full name of the Service
Principal, in the form http://app-url. Only applicable for Service
Principal logins.
 |
| `azure-sp-password` | env_var_name | AZURE_SP_PASSWORD | Name of environment variable storing the password for the Service
Principal. Only applicable for Service Principal logins.
 |
| `azure-sp-tenant` | env_var_name | AZURE_SP_TENANT | Name of environment variable storing the tenant ID for the Service Principal. Only applicable for Service Principal logins.
 |
| `azure-tenant` | env_var_name | AZURE_TENANT | Environment variable storing your Azure tenant, necessary if
`alternate-tenant` is set to true. Only applicable for user logins.
 |
| `azure-username` | env_var_name | AZURE_USERNAME | Environment variable storing your Azure username. Only applicable for
user logins.
 |
| `checkout` | boolean | true | Boolean for whether or not to checkout as a first step. Default is true.
 |
| `dockerfile` | string | Dockerfile | Name of dockerfile to use. Defaults to Dockerfile. |
| `executor` | executor | default | executor to use for this job |
| `extra-build-args` | string |  | Extra flags to pass to docker build. For examples, see https://docs.docker.com/engine/reference/commandline/build
 |
| `login-server-name` | string |  | The Azure login server for your ACR instance, e.g. {yourregistryname}.azure.io
 |
| `path` | string | . | Path to the directory containing your Dockerfile and build context. Defaults to . (working directory).
 |
| `registry-name` | string |  | The name of your ACR registry |
| `repo` | string |  | A URI to an ACR login-server-name/repository |
| `tag` | string | latest | Comma-delimited string containing docker image tags (default = latest) |
| `workspace-root` | string | . | Workspace root path that is either an absolute path or a path relative to the working directory. Defaults to '.' (the working directory)
 |

## Executors

### default

CircleCI's Ubuntu-based machine executor VM: https://circleci.com/docs/2.0/executor-types/#using-machine


| Parameter | Type | Default | Description |
|---|---|---|---|
| `dlc` | boolean | false | Enable Docker Layer Caching? |
| `image` | string | ubuntu-2004:current |  |

## Examples

### build-and-push-image

Build and push a Docker image to the Azure Container Registry (ACR)


```yaml
version: '2.1'
orbs:
  azure-acr: circleci/azure-acr@x.y.z
workflows:
  build-and-publish-docker-image:
    jobs:
      - azure-acr/build-and-push-image:
          login-server-name: exampleregistry.azurecr.io
          registry-name: exampleregistry
          repo: example-repository
          tag: $CIRCLE_TAG
```