AZ-400 exam dumps

AZ-400 practice question 150 of 306

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

AZ-400 Question 150

Select 3

You maintain multiple YAML pipelines across different projects, each requiring the same set of infrastructure provisioning tasks. You also need to share environment variables, such as subscription IDs and environment names, in a secure and consistent way across all pipelines. Which of the following actions should you take to create reusable pipeline elements and centrally manage these variables?

  1. A

    Create a separate YAML file containing the common tasks and reference it from each pipeline using the 'template' keyword.

  2. B

    Configure a variable group in the Library, store your shared variables there, and import the group into each YAML pipeline using 'variables: - group: '.

  3. C

    Use Task Groups from the classic builds by specifying the same Task Group reference in your YAML pipelines.

  4. D

    Set environment variables inline in every job so they are the same across all pipelines by default.

  5. E

    Grant access to the variable group for each pipeline that needs to consume these shared variables.

Show answer and explanation

Correct answers: A, B, E

Explanation

To minimize duplication and promote best practices in Azure DevOps, you can store common tasks in separate YAML templates and reference them across different pipelines. Similarly, variable groups in the Library allow you to centrally manage shared variables and secrets, ensuring consistency and secure access. For additional guidance, see the official Azure DevOps documentation on YAML templates and variable groups: https://docs.microsoft.com/azure/devops/pipelines/process/templates.

  • A. Correct.

    Option 1 is correct. In Azure DevOps, creating a dedicated YAML template file with reusable tasks is a recommended method for sharing a sequence of steps among multiple pipelines. You can reference this template using the 'template' keyword in your pipelines.

  • B. Correct.

    Option 2 is correct. Storing variables in a variable group within the Library enables centralized management. You can then reference this variable group in your YAML using the 'variables' section with '- group: '. This approach keeps environment-specific and secret values in one secure location.

  • C. Incorrect.

    Option 3 is incorrect. Task Groups are primarily used in classic pipelines and are not directly referenced in YAML pipelines. YAML pipelines leverage templates instead for reusability.

  • D. Incorrect.

    Option 4 is incorrect. Defining environment variables inline in each job replicates the same values multiple times and does not provide a secure or truly centralized solution. This approach increases the chance of inconsistency and manual errors.

  • E. Correct.

    Option 5 is correct. Even if you create a variable group, you must grant appropriate permissions (read access) for each pipeline that uses it. Otherwise, the pipeline will fail to consume those shared variables at runtime.

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