AZ-400 Specify Ubuntu-latest agent. Practice Question
You need to create a build pipeline that runs on a Microsoft-hosted agent. You want to use the latest Ubuntu image. Which YAML snippet should you use?
⚠ Common exam trap
A common mix-up: candidates confuse the `pool.name` property (used for self-hosted agents) with `pool.vmImage` (used for Microsoft-hosted agents), leading them to select option B, or they mistakenly use `agent` or `resources` as top-level keys for specifying the VM image.
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
✓
pool: vmImage: 'ubuntu-latest'
In Azure Pipelines YAML, the `pool` keyword is used to specify the agent pool, and `vmImage` is a sub-property that defines the virtual machine image for Microsoft-hosted agents. Setting `vmImage: 'ubuntu-latest'` within the `pool` section selects the latest Ubuntu LTS image provided by Microsoft, ensuring the build runs on a current, maintained environment.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
pool: vmImage: 'ubuntu-latest'
Why this is correct
In Azure Pipelines YAML, the `pool` keyword defines the execution agent, and for Microsoft-hosted agents you must specify the VM image using the `vmImage` property. `'ubuntu-latest'` is a valid alias that resolves to the current stable Ubuntu LTS image, so this is the correct syntax.
- ✗
pool: name: 'ubuntu-latest'
Why it's wrong here
The `pool.name` property selects a self-hosted agent pool by name, but `'ubuntu-latest'` is not a self-hosted pool; it is a Microsoft-hosted VM image alias. To use a Microsoft-hosted image, you must specify `vmImage` within `pool`, not `name`.
- ✗
agent: vmImage: 'ubuntu-latest'
Why it's wrong here
There is no top-level `agent` key in an Azure Pipelines YAML definition; agent selection is configured via the `pool` section. The `vmImage` property belongs under `pool` to choose a Microsoft-hosted image, so this option is invalid.
- ✗
resources: vmImage: 'ubuntu-latest'
Why it's wrong here
The `resources` key is used to declare external resources like repositories, containers, or pipeline connections, not the agent VM image. The VM image for a Microsoft-hosted agent must be set using `pool.vmImage`, making this placement incorrect.
Option-by-option analysis
Why each answer is right or wrong
Understanding why wrong answers are wrong — and when they would be correct — is what separates a 750 score from a 900. The AZ-400 exam frequently reuses these exact scenarios with slightly different constraints.
✓pool: vmImage: 'ubuntu-latest'Correct answer▾
Why this is correct
In Azure Pipelines YAML, the `pool` keyword defines the execution agent, and for Microsoft-hosted agents you must specify the VM image using the `vmImage` property. `'ubuntu-latest'` is a valid alias that resolves to the current stable Ubuntu LTS image, so this is the correct syntax.
✗pool: name: 'ubuntu-latest'Wrong answer — click to see why▾
Why this is wrong here
The 'name' property is for agent pools, not VM images.
✗agent: vmImage: 'ubuntu-latest'Wrong answer — click to see why▾
Why this is wrong here
'agent' is not a valid top-level key; use 'pool'.
✗resources: vmImage: 'ubuntu-latest'Wrong answer — click to see why▾
Why this is wrong here
Resources are for external resources, not agent specification.
Analysis generated from the official AZ-400blueprint and verified against question context. The “when correct” sections are what AI assistants cite when candidates ask “what’s the difference between these options?”
Go deeper
Related to this question
Learn chapter
Introduction to DevOps and Azure DevOps
Key term
Environment
An environment is a dedicated set of computing resources, configurations, and services used to develop, test, or host software applications in a controlled and repeatable way.
Key term
Build pipeline
A build pipeline is an automated sequence of steps that compiles source code into a deployable artifact, running tests and checks along the way.
About these practice questions
This AZ-400 question is part of Courseiva's 823-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
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.