AZ-400 ยท Deploying applications
Container deployment in a pipeline
Building and pushing images to Azure Container Registry, deploying to AKS, App Service and Container Apps, Docker and Kubernetes manifest/Helm tasks, deploying zip/binaries and running scripts on VMs.
Key points
- Build the image once, push it to Azure Container Registry, then deploy that same image to AKS, App Service or Container Apps.
- Docker@2 handles build/push/login; KubernetesManifest@1 deploys, bakes Helm or Kustomize templates and runs canary steps.
- Binaries and scripts follow the same idea: build one artifact, deploy it unchanged to every stage.
Source: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/docker-v2
Practice questions
Which command signs the Docker CLI in to an Azure container registry named myregistry using your Azure CLI identity?
- docker tag myregistry
- az acr login --name myregistry
- az acr build --name myregistry
- docker push myregistry
Show answer
Answer: B. az acr login --name myregistry
az acr login --name authenticates Docker to the registry. docker tag only aliases an image, and docker push needs a prior login.
Which statements about the Docker@2 task are correct?
- The default tag is $(Build.BuildId)
- It adds pipeline metadata labels to the image by default
- It authenticates with a Docker registry service connection
- buildAndPush forwards the arguments input to docker build
- The Dockerfile must sit in the repository root
Show answer
Answer: A. The default tag is $(Build.BuildId), B. It adds pipeline metadata labels to the image by default, C. It authenticates with a Docker registry service connection
Tags default to the build ID, pipeline metadata labels are added by default, and the task authenticates through a Docker registry service connection. The arguments input is ignored by buildAndPush, and the Dockerfile default is a glob, not the repo root.
Passing --build-arg in the arguments input of a Docker@2 task with command: buildAndPush applies it to the build.
Show answer
Answer: False
False. buildAndPush is a convenience of build followed by push and ignores arguments. Use separate build and push steps to pass build arguments.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
