Skip to content
Latchkey

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

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →