Courseiva
Design and implement build and release pipelineseasyMultiple ChoiceObjective-mapped

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 trigger a pipeline automatically when a pull request is created against the main branch. Which trigger type should you configure in the YAML pipeline?

⚠ Common exam trap

Candidates often confuse `trigger:` (CI on push) with `pr:` (PR validation), especially since both can be used for the same branch, but they serve different events and have distinct 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

pr:

The `pr:` trigger in Azure Pipelines YAML is specifically designed to automatically start a pipeline when a pull request is created or updated against a specified branch. By default, `pr:` triggers are enabled for all branches; however, to ensure the pipeline only runs for PRs targeting `main`, you configure `pr: main`. This triggers the pipeline on PR creation/update without needing a separate branch policy.

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:

    Why this is correct

    The `pr:` keyword in an Azure Pipelines YAML file defines the branch filters that trigger a pipeline on pull requests (PRs) targeting those branches. This is the correct mechanism for PR validation, as it specifically listens to PR creation and updates, unlike other trigger types.

  • trigger:

    Why it's wrong here

    The `trigger:` keyword configures CI triggers that run a pipeline on push events to the specified branches. Since the question asks about pull requests, a push trigger does not fire on PR activity, so it is incorrect for this scenario.

  • schedules:

    Why it's wrong here

    The `schedules:` keyword defines cron-based triggers that run a pipeline at specific times, independent of any code events. It does not respond to pull requests, so it cannot be used to validate PR changes.

  • resources:

    Why it's wrong here

    The `resources:` keyword declares external resources such as other pipelines, repositories, containers, or packages, and can define triggers for those resources (e.g., pipeline resource triggers). It does not define a PR trigger for the current pipeline, so it is not the correct answer.

About these practice questions

Courseiva writes every AZ-400 question from scratch — 823 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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.