A developer needs to push a locally built container image to a private Azure Container Registry (ACR) named contosoacr. The developer is already authenticated to their Azure subscription using the Azure CLI on their local workstation. Which command should the developer run on their workstation to authenticate the local Docker CLI to the registry using their active Azure CLI session?
- az acr login --name contosoacrAnswer
- Bdocker login contosoacr.azurecr.io
- Caz login --identity
- Daz acr login --username contosoacr
Answer
az acr login --name contosoacr
The command starting with 'az acr login' with the '--name' parameter is correct because it uses the credentials of the logged-in Azure CLI user to obtain an access token and automatically configure the local Docker client to access the Azure Container Registry.
Step-by-Step Solution
Key Concept
Azure Container Registry CLI Authentication