AZ-400 exam dumps

AZ-400 practice question 148 of 306

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

AZ-400 Question 148

Single answer

Your team has several microservices that follow the same build and deployment steps. Each microservice� pipeline needs to compile the code, run unit tests, and then package the build artifacts. You want to manage these steps in a single location so that updates to these tasks apply to all pipelines without manually editing each one. Which approach should you take to achieve this goal?

  1. A

    Create a YAML template containing the build, test, and package steps, then reference it in each microservice� pipeline

  2. B

    Define a task group for each microservice separately and store the tasks in the microservice repository

  3. C

    Use runtime variables to store the build, test, and package commands, then reference them in scripts within each pipeline

  4. D

    Set up a variable group to hold shared environment variables for each microservice, and manually copy tasks into each pipeline

Show answer and explanation

Correct answer: A

Explanation

Using YAML templates is the recommended approach for reusing pipeline tasks in Azure DevOps. By creating a dedicated template file that contains the build, test, and package steps, then referencing it in each microservice� pipeline, you ensure easy maintenance and a single source of truth. Microsoft recommends YAML templates for modularizing and sharing pipeline configurations. For more guidance, see the official Azure DevOps documentation: https://docs.microsoft.com/en-us/azure/devops/pipelines/process/templates

  • A. Correct.

    Option 1 is correct. YAML templates allow you to define reusable steps in a single file and reference them in multiple pipelines. This centralizes maintenance, making it easier to update tasks in one place. According to Microsoft documentation, referencing a separate YAML template is the recommended way to reuse common steps across pipelines.

  • B. Incorrect.

    Option 2 is incorrect. While task groups can facilitate reuse within classic pipelines, in YAML pipelines, templates are the preferred mechanism. Also, defining separate task groups for each microservice does not provide a single source of truth.

  • C. Incorrect.

    Option 3 is incorrect. Runtime variables alone do not encapsulate the entire build, test, and package logic. You would still have to copy the pipeline steps across multiple pipelines, which is what you are trying to avoid.

  • D. Incorrect.

    Option 4 is incorrect. A variable group is useful for storing shared variables (e.g., connection strings, keys), but it does not itself manage the build, test, and package tasks. You would still need a reusable step definition, which variable groups do not provide.

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