AZ-400 exam dumps

AZ-400 practice question 137 of 306

Designing and Implementing Microsoft DevOps Solutions. Professional level, Microsoft. Free question with the correct answer and a full explanation.

AZ-400 Question 137

Single answer

You have an Azure DevOps pipeline that builds and deploys an application from the 'main' branch. Currently, every push to 'main' triggers the pipeline, including changes made exclusively to files in the '/documentation' folder, resulting in unnecessary runs. You want to configure the pipeline so that changes to any file in '/documentation' do NOT trigger the pipeline, while all other changes in 'main' still do. Which configuration should you use in your azure-pipelines.yml file?

  1. A

    A) Configure 'trigger: none' and only use pipeline resources referencing the 'main' branch to start the pipeline.

  2. B

    B) Set 'pr: none' in your YAML file and define a pull request trigger path exclusion rule for '/documentation/*'.

  3. C

    C) Set 'trigger: branches: include: [main]', and under 'paths', define an 'exclude' rule for '/documentation/*'.

  4. D

    D) Create a second pipeline specifically for documentation updates, leaving the original pipeline unmodified.

Show answer and explanation

Correct answer: C

Explanation

In Azure DevOps YAML pipelines, you can refine CI triggers by specifying branch and path filters. The correct solution is to include the 'main' branch under 'branches: include:', then exclude the '/documentation/*' path so that changes there do not cause a build. For more information, see the Microsoft Docs on Azure Pipelines triggers: https://learn.microsoft.com/azure/devops/pipelines/repos/azure-repos-git#azure-pipelines-yaml-ci-triggers.

  • A. Incorrect.

    A) Incorrect. Setting 'trigger: none' disables all CI triggers from the repo. You would then have to add pipeline resources or manually run the pipeline, which does not fulfill the requirement of automatically building on changes outside '/documentation'.

  • B. Incorrect.

    B) Incorrect. 'pr: none' affects pull request triggers but does not impact continuous integration (CI) triggers for direct pushes to 'main'. You also need CI triggers, which this option does not correctly address.

  • C. Correct.

    C) Correct. Specifying 'trigger: branches: include: [main]' means CI triggers occur on any changes pushed to 'main'. Adding 'paths: exclude: [/documentation/*]' ensures that changes only within '/documentation' do not trigger a pipeline run, satisfying the requirement.

  • D. Incorrect.

    D) Incorrect. While you could split pipelines, this does not directly address excluding '/documentation' from the existing pipeline's triggers. It also adds unnecessary complexity.

Timed practice exam

Take a AZ-400 practice test under exam conditions

70 questions in 90 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam