AZ-400 exam dumps

AZ-400 practice question 141 of 306

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

AZ-400 Question 141

Select 2

You are designing a YAML-based pipeline in Azure DevOps for building and deploying a .NET Core application. The pipeline must automatically trigger on any new commit to the 'main' branch. Additionally, you want to store environment-specific configuration values in a separate YAML template so that your pipeline code remains clean and easily maintainable. Which two sections in your main YAML file must you configure to meet these requirements?

  1. A

    A. Define a 'trigger' subsection to include the 'main' branch in your pipeline.

  2. B

    B. Use an 'extends' block referencing a YAML template that declares the environment-specific settings.

  3. C

    C. Specify an 'environment: main' attribute within each job to ensure the pipeline triggers on commits to 'main'.

  4. D

    D. Add a 'resources: variables:' block to reference environment-specific secrets from an external Key Vault.

Show answer and explanation

Correct answers: A, B

Explanation

In Azure DevOps YAML pipelines, specifying 'trigger: [main]' (or similar syntax) is the recommended way to automatically build and test code changes whenever a push occurs to the 'main' branch. Additionally, using an 'extends' block to reference a separate YAML template is a best practice for organizing environment-specific settings in a modular, maintainable way. Refer to the Azure DevOps documentation on 'YAML schema' and 'Template reuse' for more details (https://docs.microsoft.com/azure/devops/pipelines/yaml-schema).

  • A. Correct.

    A. Correct. A 'trigger' section that includes the 'main' branch ensures your pipeline automatically runs whenever a new commit is pushed to 'main'. This directly addresses the requirement for automatic builds on commit.

  • B. Correct.

    B. Correct. An 'extends' section allows you to reference and reuse content from another YAML file, such as a template for environment-specific configuration. This approach keeps your primary pipeline file concise and maintainable.

  • C. Incorrect.

    C. Incorrect. Using 'environment: main' within a job does not configure a trigger. The 'environment' keyword is typically used for deployment targets or approvals, not branch-based triggers.

  • D. Incorrect.

    D. Incorrect. While referencing an external Key Vault can be useful for secrets, it does not inherently address the requirement to store environment-specific configuration in a separate YAML template. Key Vault integration is a separate feature and is not necessary for simply including a standalone YAML template.

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