AZ-400 Question 149
Select 2Your team maintains several pipelines in Azure DevOps for deploying a web application to multiple environments. You want to standardize and re-use the same build and deployment tasks across these pipelines while also centrally managing environment-specific variables. Which two actions should you implement to achieve these goals?
- A
Create a YAML template with common build and deployment tasks and reference it from each pipeline.
- B
Use an Azure DevOps variable group to manage shared environment variables and secrets.
- C
Store environment-specific secrets in a text file within your repository for easy reference.
- D
Create separate identical pipelines for each environment to avoid confusion about shared configurations.
Show answer and explanation
Correct answers: A, B
Explanation
Azure DevOps supports reusability through YAML templates and centralized management of configuration via variable groups. See Microsoft Documentation on templates (https://learn.microsoft.com/azure/devops/pipelines/process/templates) and on managing variables and variable groups (https://learn.microsoft.com/azure/devops/pipelines/library/variable-groups) for best practices in creating and maintaining reusable pipeline elements.
- A. Correct.
Option 1: Correct. YAML templates let you define repeatable tasks or stages that can be referenced by multiple pipelines. This improves consistency and maintainability by having a single source of truth for commonly used steps.
- B. Correct.
Option 2: Correct. Variable groups store environment-specific and shared variables in one place, reducing duplication and simplifying updates. Secrets can also be securely managed within variable groups or linked from Azure Key Vault.
- C. Incorrect.
Option 3: Incorrect. Storing sensitive data in plain text in a code repository is insecure. Azure DevOps variable groups or Azure Key Vault references are the recommended approaches for handling secrets securely.
- D. Incorrect.
Option 4: Incorrect. Creating separate pipelines that duplicate tasks increases maintenance overhead and risks inconsistencies. Leveraging YAML templates and variable groups remains a more efficient and maintainable approach.