Start Building for Free

Deploy to Azure Container Registry

5 days ago1 min read
Server v4.x
Server v3.x
Server v2.x

This page describes a simple deployment to the Azure Container Registry (ACR) using the CircleCI ACR orb and version 2.1 configuration.

To take advantage of secrets masking, it is best practice to set environment variables at the project level or within a context.

For detailed information about the Azure ACR orb, including all options, refer to the CircleCI ACR Orb Reference page.

  1. Whether your require a user or service principal login, you will need to provide environment variables for username, password and tenant to CircleCI. For user logins use env var names as follows: AZURE_USERNAME, AZURE_PASSWORD and AZURE_TENANT. For service principal logins use: AZURE_SP, AZURE_SP_PASSWORD and AZURE_SP_TENANT.

  2. Use the orb’s build-and-push-image job to build your image and deploy it to ACR. Note the use of workflows to deploy only if the current branch is main.

    version: 2.1 # Use version 2.1 config to get access to orbs, pipelines
        azure-acr: circleci/azure-acr@x.y.z # Use the Azure ACR orb in your config
            - azure/build-and-push-image:
                dockerfile: <name-of-your-dockerfile> # defaults to `Dockerfile`
                path: <path-to-your-dockerfile> # Defaults to working directory
                login-server-name: <your-login-server-name> # e.g. {yourregistryname}
                registry-name: <your-ACR-registry-name>
                repo: <URI-to-your-login-server-name>
                    only: main # Only deploys when the commit is on the Main branch

If pushing to your repository is required, see the "Deployment Keys" section of the GitHub or Bitbucket instructions. Then, configure the Azure Web App to use your production branch.

Help make this document better

This guide, as well as the rest of our docs, are open source and available on GitHub. We welcome your contributions.

Need support?

Our support engineers are available to help with service issues, billing, or account related questions, and can help troubleshoot build configurations. Contact our support engineers by opening a ticket.

You can also visit our support site to find support articles, community forums, and training resources.