az acr login: Authenticate to ACR in CI
Authenticate the local Docker client to an Azure Container Registry.
az acr login obtains a short-lived token from ACR and configures Docker to use it. In CI you run it after az login, then docker push and docker pull work against the registry without managing admin credentials.
Common flags
-n, --name REGISTRY- the ACR name (without .azurecr.io)--expose-token- return a token instead of configuring Docker
Example in CI
Log in to the registry, then push an image.
shell
az acr login --name myregistry
docker push myregistry.azurecr.io/app:${GITHUB_SHA}Common errors in CI
- unauthorized: authentication required - az login not run or SP lacks AcrPush
- Could not connect to the registry login server - wrong registry name
- DOCKER_COMMAND_ERROR ... docker daemon - no Docker daemon available on the runner
Key takeaways
- Configures Docker to authenticate to ACR using your Azure credentials.
- Grant the AcrPush role to the service principal for pushes.
- Requires a running Docker daemon unless you use --expose-token.
Related guides
az login: Authenticate Azure CLI in CIAuthenticate the Azure CLI in CI with a service principal or federated token: flags, an example, and the auth…
az webapp deploy: Deploy App Service in CIDeploy a zip or artifact to Azure App Service from CI: source and type flags, an example, and the deploy erro…
az containerapp update: Roll Out Container Apps in CIUpdate an Azure Container App image from CI: image and env flags, a deploy example, and the revision errors y…