Deploy to Azure Container Registry
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.
-
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
andAZURE_TENANT
. For service principal logins use:AZURE_SP
,AZURE_SP_PASSWORD
andAZURE_SP_TENANT
. -
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 ismain
.version: 2.1 # Use version 2.1 config to get access to orbs, pipelines orbs: azure-acr: circleci/azure-acr@x.y.z # Use the Azure ACR orb in your config workflows: build-deploy: jobs: - 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}.azure.io registry-name: <your-ACR-registry-name> repo: <URI-to-your-login-server-name> filters: branches: only: main # Only deploys when the commit is on the Main 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.
- Suggest an edit to this page (please read the contributing guidefirst).
- To report a problem in the documentation, or to submit feedback and comments, please open an issue on GitHub.
- CircleCI is always seeking ways to improve your experience with our platform. If you would like to share feedback, please join our research community.
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.
CircleCI Documentation by CircleCI is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.