AZ-400 Practice Question: Design and implement build and release pipelines
Your team uses a YAML-based build pipeline in Azure Pipelines. You need to ensure that the pipeline runs automatically when a pull request is created against the main branch, but only if the changes include modifications to the 'src/' directory. Which trigger configuration should you use?
⚠ Common exam trap
Test-takers frequently confuse CI triggers (`trigger`) with PR triggers (`pr`) and forget that path filtering must be explicitly specified under the PR trigger to restrict which file changes initiate the pipeline.
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
✓
trigger: none; pr: branches: include: - main paths: include: - src/*
It sets `trigger: none` to disable CI triggers on commits, and uses a PR trigger with `branches: include: - main` and `paths: include: - src/*` to ensure the pipeline only runs automatically when a pull request targets the main branch and the changes include modifications to the 'src/' directory. This configuration meets the requirement of conditional PR-triggered builds based on file paths.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
trigger: - main; pr: none
Why it's wrong here
This configuration sets a continuous integration trigger on the main branch, causing the pipeline to run on every push to main, but it disables PR triggers with 'pr: none'. Therefore, pull requests will not trigger the pipeline at all, so PR validation is missing even when changes are made to the src/ folder.
- ✓
trigger: none; pr: branches: include: - main paths: include: - src/*
Why this is correct
This is the correct configuration because it disables CI triggers entirely (trigger: none) and defines a PR trigger that runs only for pull requests targeting the main branch and only when changes occur under the src/ path. This filters out irrelevant PRs, ensuring the pipeline runs precisely when code in src/ is modified, saving resources and providing focused validation.
- ✗
trigger: none; pr: - main
Why it's wrong here
This configuration disables CI triggers but enables PR triggers for all pull requests targeting main, without any path filtering. As a result, any change in a PR, regardless of whether it affects src/ or other directories, will trigger the pipeline, which can lead to unnecessary builds and slower feedback for unrelated changes.
- ✗
pr: - main; trigger: - main
Why it's wrong here
This configuration sets both a CI trigger on main and a PR trigger for PRs targeting main, but lacks path filters. Consequently, the pipeline runs on every push to main and on every PR to main, irrespective of which files are modified, causing inefficient builds that are not scoped to the src/ directory as required.
Go deeper
Related to this question
Learn chapter
Introduction to DevOps and Azure DevOps
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.
Key term
Branch
A branch is a pointer to a specific commit in a version control system that allows you to work on features or fixes in isolation from the main codebase.
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.