Bitzu

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

Single choice

Which command signs the Docker CLI in to an Azure container registry named myregistry using your Azure CLI identity?

  1. docker tag myregistry
  2. az acr login --name myregistry
  3. az acr build --name myregistry
  4. 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.

Select all that apply

Which statements about the Docker@2 task are correct?

  1. The default tag is $(Build.BuildId)
  2. It adds pipeline metadata labels to the image by default
  3. It authenticates with a Docker registry service connection
  4. buildAndPush forwards the arguments input to docker build
  5. 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.

True or false

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.

Download on the App StoreGet it on Google Play

More AZ-400 topics in this module