Courseiva

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

Your team uses an Azure Pipelines YAML build pipeline to compile a .NET solution. The pipeline is defined in a repository named 'ContosoApp'. You need to ensure that the build runs only when changes are pushed to the 'main' branch, and that it does not run for any other branch. Which trigger configuration should you use?

⚠ Common exam trap

Many candidates confuse branch filters with path filters, or mixing up CI triggers with PR triggers, leading to incorrect YAML syntax.

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: branches: include: - main

The trigger block with branches.include is the standard way to specify which branches trigger a YAML pipeline. Including only main ensures the pipeline runs exclusively for pushes to main, meeting the requirement. The other options either exclude main, configure PR triggers, or misuse path filters.

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: branches: exclude: - main

    Why it's wrong here

    This configuration excludes the main branch from triggering the pipeline. The requirement is to run only for main, so excluding main would cause the pipeline to run for all other branches except main. This is the opposite of what is needed and would not satisfy the scenario.

  • ✗

    pr: branches: include: - main

    Why it's wrong here

    The pr block configures pull request triggers, not continuous integration triggers. It causes the pipeline to run when a pull request targets main, not when changes are pushed to main. This does not meet the requirement of running on pushes to main.

  • ✗

    trigger: paths: include: - main

    Why it's wrong here

    The paths filter is used to include or exclude file paths, not branches. Specifying 'main' under paths would be interpreted as a file or folder path, which is invalid for branch filtering. This configuration would not correctly limit triggers to the main branch.

  • ✓

    trigger: branches: include: - main

    Why this is correct

    This configuration uses the trigger block with branches.include set to main, which is the correct YAML syntax to limit CI triggers to the main branch. It ensures the pipeline runs only when changes are pushed to main, satisfying the requirement. Other branches are excluded by default because only main is included.

About these practice questions

One of 696 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 and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Microsoft exam blueprint

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.