Courseiva
Design and implement build and release pipelineseasyMultiple ChoiceObjective-mapped

AZ-400 Practice Question: Design and implement build and release pipelines

You have a YAML pipeline that builds a Docker image and pushes it to Azure Container Registry (ACR). You need to dynamically set the image tag based on the build number. Which predefined variable should you use?

⚠ Common exam trap

Candidates may confuse `Build.BuildNumber` (the human-readable build name) with `Build.BuildId` (the internal numeric ID). The stem explicitly says 'based on the build number', so `Build.BuildNumber` is the correct choice.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

$(Build.BuildNumber)

The `$(Build.BuildNumber)` variable represents the build number, which is the name of the completed build. It's often customized to include versioning information, and it's the appropriate variable to use when tagging Docker images based on the build number. `$(Build.BuildId)` is a unique numeric ID for the build record, but it is not the build number.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • $(System.JobId)

    Why it's wrong here

    System.JobId is a job-level identifier that uniquely identifies each job invocation within a pipeline run, not the overall build run. Since a single build can have multiple jobs or be re-run, this value changes per job and cannot be used as a stable, build-wide image tag.

  • $(System.TeamProject)

    Why it's wrong here

    System.TeamProject is the friendly name of the Azure DevOps project containing the pipeline, such as 'MyProject', and is not unique to an individual build. Using it as a Docker tag would produce identical tags for every build in the project, leading to collisions and making image versions indistinguishable.

  • $(Build.BuildNumber)

    Why this is correct

    Build.BuildNumber is a human-readable, configurable build name that often includes non-alphanumeric characters like colons, dashes, or custom text. Docker tags must be lowercase alphanumeric and may contain only periods, underscores, and hyphens, so directly using BuildNumber risks invalid tags that fail the build unless the value is sanitized.

  • $(Build.BuildId)

    Why it's wrong here

    Build.BuildId is a unique, immutable, numeric identifier assigned by Azure DevOps to each build run, consisting only of digits. Because it is guaranteed to be an integer, it satisfies Docker tag constraints and provides a unique, traceable tag for every build, making it the correct choice for tagging a Docker image.

About these practice questions

One of 823 original AZ-400 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This AZ-400 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-400 exam.