Courseiva
Design and implement build and release pipelineseasyMultiple ChoiceObjective-mapped

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

You need to create a pipeline that triggers only when changes are made to files in the 'src/api' folder. Which trigger configuration should you use?

⚠ Common exam trap

Test-takers frequently confuse `include` with `exclude` or forget that path filters require explicit `include` statements to restrict triggers, leading them to pick option B which does the opposite of what is asked.

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: paths: include: - 'src/api/*'

The `trigger: paths: include: - 'src/api/*'` configuration tells Azure Pipelines to only trigger the pipeline when changes are detected in files matching that path pattern. This is the standard way to scope pipeline triggers to specific folders or file patterns in YAML pipelines, ensuring that unrelated changes elsewhere in the repository do not start the pipeline.

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

    Why it's wrong here

    The `branches` filter controls which Git branches should trigger the pipeline, not which file paths. Configuring `include: 'main'` means the pipeline will trigger on any commit pushed to `main`, regardless of which files were changed—so it would still run for changes outside `src/api`, failing the 'only when changes to that path' requirement.

  • trigger: paths: exclude: - 'src/api/*'

    Why it's wrong here

    The `paths` filter with `exclude` does the opposite of what is needed: it tells the pipeline to *ignore* commits that modify files under `src/api/*`. As a result, the pipeline would trigger only when changes are made to other paths, and would *not* trigger when changes directly affect `src/api/*`—exactly the opposite of the desired behavior.

  • trigger: tags: include: - 'v*'

    Why it's wrong here

    The `tags` filter triggers the pipeline when a Git tag matching the pattern (e.g., `v*`) is created, not when code changes occur in a particular directory. This is unrelated to file-path-based triggering, so it would not restrict runs to changes under `src/api/*`.

  • trigger: paths: include: - 'src/api/*'

    Why this is correct

    The `paths` filter with `include` is correct because it defines a file-path allowlist: the pipeline only triggers when a commit changes files under the `src/api/*` path. This ensures the pipeline runs exclusively when modifications occur in that directory, satisfying the requirement to trigger only on changes to `src/api`.

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.