1. circleci/azure-acr@0.2.3

circleci/azure-acr@0.2.3

Certified
Sections
Easily build images and push them to the Azure Container Registry.
Created: May 20, 2019Version Published: January 28, 2025Releases: 9
Org Usage:
54

Orb Quick Start Guide

Use CircleCI version 2.1 at the top of your .circleci/config.yml file.

1 version: 2.1

Add the orbs stanza below your version, invoking the orb:

1 2 orbs: azure-acr: circleci/azure-acr@0.2.3

Use azure-acr elements in your existing workflows and jobs.

Usage Examples

build-and-push-image

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

1 2 3 4 5 6 7 8 9 10 11 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

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

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

Commands

acr-login

Authenticate into Azure Container Registry service

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
registry-name
Name of env var storing your registry name, defaults to REGISTRY_NAME
No
REGISTRY_NAME
string

build-and-push-image

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

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

Executors

default

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

Show executor Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
dlc
Enable Docker Layer Caching?
No
false
boolean
image
-
No
ubuntu-2004:current
string

Orb Source

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 # This code is licensed from CircleCI to the user under the MIT license. # See here for details: https://circleci.com/developer/orbs/licensing version: 2.1 description: | Easily build images and push them to the Azure Container Registry. display: source_url: https://github.com/CircleCI-Public/azure-acr-orb orbs: azure-cli: circleci/azure-cli@1.2.2 docker: circleci/docker@0.6 commands: acr-login: description: Authenticate into Azure Container Registry service parameters: registry-name: default: REGISTRY_NAME description: | Name of env var storing your registry name, defaults to REGISTRY_NAME type: string steps: - run: command: | az acr login --name << parameters.registry-name >> name: Log into ACR build-and-push-image: description: | Install Azure CLI, if needed, and configure. Log into ACR and push image to repository. parameters: alternate-tenant: default: false description: Use an alternate tenant. Only applicable for user logins. type: boolean attach-workspace: default: false description: | Boolean for whether or not to attach to an existing workspace. Default is false. type: boolean azure-password: default: AZURE_PASSWORD description: | Environment variable storing your Azure password. Only applicable for user logins. type: env_var_name azure-sp: default: AZURE_SP description: | Name of environment variable storing the full name of the Service Principal, in the form http://app-url. Only applicable for Service Principal logins. type: env_var_name azure-sp-password: default: AZURE_SP_PASSWORD description: | Name of environment variable storing the password for the Service Principal. Only applicable for Service Principal logins. type: env_var_name azure-sp-tenant: default: AZURE_SP_TENANT description: | Name of environment variable storing the tenant ID for the Service Principal. Only applicable for Service Principal logins. type: env_var_name azure-tenant: default: AZURE_TENANT description: | Environment variable storing your Azure tenant, necessary if `alternate-tenant` is set to true. Only applicable for user logins. type: env_var_name azure-username: default: AZURE_USERNAME description: | Environment variable storing your Azure username. Only applicable for user logins. type: env_var_name checkout: default: true description: | Boolean for whether or not to checkout as a first step. Default is true. type: boolean dockerfile: default: Dockerfile description: Name of dockerfile to use. Defaults to Dockerfile. type: string executor: default: default description: executor to use for this job type: executor extra-build-args: default: "" description: | Extra flags to pass to docker build. For examples, see https://docs.docker.com/engine/reference/commandline/build type: string lint-dockerfile: default: false description: | Lint Dockerfile before building? type: boolean login-server-name: description: | The Azure login server for your ACR instance, e.g. {yourregistryname}.azure.io type: string path: default: . description: | Path to the directory containing your Dockerfile and build context. Defaults to . (working directory). type: string registry-name: description: The name of your ACR registry type: string repo: description: Name of an ACR repository type: string tag: default: latest description: Comma-delimited string containing docker image tags (default = latest) type: string treat-warnings-as-errors: default: false description: | If linting Dockerfile, treat linting warnings as errors (would trigger an exist code and fail the CircleCI job)? type: boolean workspace-root: default: . description: | Workspace root path that is either an absolute path or a path relative to the working directory. Defaults to '.' (the working directory) type: string steps: - when: condition: <<parameters.checkout>> steps: - checkout - azure-cli/install - azure-cli/login-with-user-or-service-principal: alternate-tenant: <<parameters.alternate-tenant>> azure-password: <<parameters.azure-password>> azure-sp: <<parameters.azure-sp>> azure-sp-password: <<parameters.azure-sp-password>> azure-sp-tenant: <<parameters.azure-sp-tenant>> azure-tenant: <<parameters.azure-tenant>> azure-username: <<parameters.azure-username>> - when: condition: <<parameters.attach-workspace>> steps: - attach_workspace: at: <<parameters.workspace-root>> - acr-login: registry-name: <<parameters.registry-name>> - docker/build: dockerfile: <<parameters.dockerfile>> extra_build_args: <<parameters.extra-build-args>> image: <<parameters.repo>> lint-dockerfile: <<parameters.lint-dockerfile>> path: <<parameters.path>> registry: <<parameters.login-server-name>> step-name: Build Docker image for ACR tag: <<parameters.tag>> treat-warnings-as-errors: <<parameters.treat-warnings-as-errors>> - docker/push: image: <<parameters.repo>> registry: <<parameters.login-server-name>> step-name: Push Docker image to ACR tag: <<parameters.tag>> executors: default: description: | CircleCI's Ubuntu-based machine executor VM: https://circleci.com/docs/2.0/executor-types/#using-machine machine: docker_layer_caching: <<parameters.dlc>> image: <<parameters.image>> parameters: dlc: default: false description: Enable Docker Layer Caching? type: boolean image: default: ubuntu-2004:current type: string jobs: build-and-push-image: description: | 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). executor: <<parameters.executor>> parameters: alternate-tenant: default: false description: Use an alternate tenant. Only applicable for user logins. type: boolean attach-workspace: default: false description: | Boolean for whether or not to attach to an existing workspace. Default is false. type: boolean azure-password: default: AZURE_PASSWORD description: | Environment variable storing your Azure password. Only applicable for user logins. type: env_var_name azure-sp: default: AZURE_SP description: | Name of environment variable storing the full name of the Service Principal, in the form http://app-url. Only applicable for Service Principal logins. type: env_var_name azure-sp-password: default: AZURE_SP_PASSWORD description: | Name of environment variable storing the password for the Service Principal. Only applicable for Service Principal logins. type: env_var_name azure-sp-tenant: default: AZURE_SP_TENANT description: | Name of environment variable storing the tenant ID for the Service Principal. Only applicable for Service Principal logins. type: env_var_name azure-tenant: default: AZURE_TENANT description: | Environment variable storing your Azure tenant, necessary if `alternate-tenant` is set to true. Only applicable for user logins. type: env_var_name azure-username: default: AZURE_USERNAME description: | Environment variable storing your Azure username. Only applicable for user logins. type: env_var_name checkout: default: true description: | Boolean for whether or not to checkout as a first step. Default is true. type: boolean dockerfile: default: Dockerfile description: Name of dockerfile to use. Defaults to Dockerfile. type: string executor: default: default description: executor to use for this job type: executor extra-build-args: default: "" description: | Extra flags to pass to docker build. For examples, see https://docs.docker.com/engine/reference/commandline/build type: string login-server-name: description: | The Azure login server for your ACR instance, e.g. {yourregistryname}.azure.io type: string path: default: . description: | Path to the directory containing your Dockerfile and build context. Defaults to . (working directory). type: string registry-name: description: The name of your ACR registry type: string repo: description: A URI to an ACR login-server-name/repository type: string tag: default: latest description: Comma-delimited string containing docker image tags (default = latest) type: string workspace-root: default: . description: | Workspace root path that is either an absolute path or a path relative to the working directory. Defaults to '.' (the working directory) type: string steps: - build-and-push-image: alternate-tenant: <<parameters.alternate-tenant>> attach-workspace: <<parameters.attach-workspace>> azure-password: <<parameters.azure-password>> azure-sp: <<parameters.azure-sp>> azure-sp-password: <<parameters.azure-sp-password>> azure-sp-tenant: <<parameters.azure-sp-tenant>> azure-tenant: <<parameters.azure-tenant>> azure-username: <<parameters.azure-username>> checkout: <<parameters.checkout>> dockerfile: <<parameters.dockerfile>> extra-build-args: <<parameters.extra-build-args>> login-server-name: <<parameters.login-server-name>> path: <<parameters.path>> registry-name: <<parameters.registry-name>> repo: <<parameters.repo>> tag: <<parameters.tag>> workspace-root: <<parameters.workspace-root>> examples: build-and-push-image: description: | Build and push a Docker image to the Azure Container Registry (ACR) usage: 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
Developer Updates
Get tips to optimize your builds
Or join our research panel and give feedback
By submitting this form, you are agreeing to ourTerms of UseandPrivacy Policy.