AZ-400 Practice Question: Design and implement build and release pipelines
Your team uses GitHub for source control and Azure Pipelines for CI/CD. You need to ensure that only pull requests from specific branches trigger a build pipeline. Which trigger configuration should you use?
⚠ Common exam trap
It's easy for candidates to confuse `pr` triggers (for pull requests) with `trigger` triggers (for CI builds on commits), leading candidates to select option C which targets commits instead of PRs.
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
✓
pr: branches: include: - main - develop
The `pr` trigger in Azure Pipelines controls which pull requests trigger a pipeline. By using `branches` with `include`, you specify that only PRs targeting the `main` and `develop` branches should trigger the build. This directly meets the requirement to restrict PR triggers to specific branches.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
pr: paths: include: - main - develop
Why it's wrong here
This YAML uses `paths` under `pr`, which filters pull request triggers based on files changed, not branch names. Listing `main` and `develop` as paths means the pipeline only runs when files named `main` or `develop` are modified, which is not the intended branch filter. To trigger on PRs targeting branches, use `branches` with `include`.
- ✗
pr: branches: only: - main
Why it's wrong here
In Azure Pipelines PR triggers, the `branches` keyword accepts `include` and `exclude`, but `only` is not a valid key. Using `only` will cause a schema validation error or silently ignore the filter, so the pipeline won't trigger as expected. The correct syntax is `pr: branches: include: main`.
- ✗
trigger: branches: include: - main - develop
Why it's wrong here
The `trigger` keyword defines continuous integration (CI) triggers that run on pushes to specified branches, not on pull request creation or updates. Since this pipeline should respond to PRs, you need the `pr` keyword with `branches: include` to filter PRs targeting `main` or `develop`.
- ✓
pr: branches: include: - main - develop
Why this is correct
This is the correct YAML syntax for filtering PR triggers by target branch. The `pr` keyword enables PR validation, and `branches: include` specifies that only PRs targeting `main` or `develop` should be built, ensuring the pipeline runs only for those branches.
Go deeper
Related to this question
Learn chapter
Introduction to DevOps and Azure DevOps
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.
Key term
Azure Pipelines
Azure Pipelines is a cloud-based CI/CD service from Microsoft that automatically builds, tests, and deploys code to any platform or cloud.
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 →
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.