Courseiva
Design and implement build and release pipelinesmediumMultiple ChoiceObjective-mapped

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

Your team uses GitFlow with Azure Repos. You need to ensure that every commit to the 'main' branch is built and deployed to production automatically. Which trigger should you configure in your YAML 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: branches: include: - main

A branch-specific trigger defined with `trigger: branches: include: - main` will automatically run the pipeline on every commit to the 'main' branch. Option A is wrong because `trigger: none` disables CI triggers entirely, so the pipeline will not start on any commits. Option C is wrong because a scheduled trigger (`schedules:`) runs the pipeline at specific times, not in response to commits. Option D is wrong because a PR trigger (`pr:`) runs the pipeline when a pull request is created or updated, not on direct commits to 'main'.

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: none

    Why it's wrong here

    Setting `trigger: none` explicitly disables all continuous integration triggers in Azure Pipelines, meaning the pipeline will never automatically start on commits to any branch, including main. The only way to run it is manually via the UI, Azure CLI, or REST API, which fails the requirement to trigger on every commit to main.

  • trigger: branches: include: - main

    Why this is correct

    This YAML defines a continuous integration trigger on the `main` branch, causing Azure Pipelines to automatically queue a new run whenever a commit is pushed to `main`. Because GitFlow's main branch is the integration branch for releases and hotfixes, this ensures every commit that lands on main is validated by the pipeline.

  • schedules: - cron: "0 0 * * *" branches: include: - main

    Why it's wrong here

    A scheduled trigger uses a cron expression (here daily at 00:00) to run the pipeline at fixed times, regardless of whether any new commits have occurred. It does not react to commits pushed to `main`, so it cannot guarantee that every commit triggers a build—it only provides periodic validation.

  • pr: branches: include: - main

    Why it's wrong here

    A PR trigger configures the pipeline to run when a pull request targeting `main` is created or updated, building the merge result of that PR. Direct commits or merges to `main` (e.g., from a release branch or a hotfix merge) do not activate the pipeline under this setting, so it fails the 'every commit to main' requirement.

Go deeper

Related to this question

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 →

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.