AZ-400 Question 201
Select 2Your organization is experiencing intermittent failures in several Azure DevOps pipelines due to environment inconsistencies and outdated pipeline definitions. You have been tasked with maintaining these build and release pipelines to ensure reliability and reduce downtime. Which two actions should you implement to improve pipeline maintainability and minimize failures?
- A
Store pipeline definitions in version control (e.g., YAML) and reference them from your repository
- B
Use ephemeral build agents or containers to ensure a clean environment for each pipeline run
- C
Hardcode environment variables in the script to avoid external file dependencies
- D
Configure personal access tokens (PATs) with indefinite expiration to eliminate frequent renewals
Show answer and explanation
Correct answers: A, B
Explanation
Maintaining a reliable and secure pipeline includes adopting methods that ensure consistent builds and secure credentials management. According to Microsoft� recommended DevOps practices, version-controlling pipeline definitions (via YAML) promotes better collaboration and rollback capabilities. Similarly, employing ephemeral build agents avoids persistent environment state issues, which are a common source of pipeline failures. References: Microsoft Docs on YAML pipelines (https://docs.microsoft.com/azure/devops/pipelines/yaml-pipeline-design) and agent management best practices (https://docs.microsoft.com/azure/devops/pipelines/agents/hosted).
- A. Correct.
Storing your pipeline definitions in version control as YAML helps maintain a history of changes and makes rolling back to a previous known-good configuration simpler. This approach also aligns with best practices for Infrastructure as Code (IaC).
- B. Correct.
Using ephemeral build agents (or containers) ensures that each pipeline run starts with a predictable and pristine environment, minimizing the likelihood of inconsistencies and environment drift.
- C. Incorrect.
Hardcoding environment variables within the pipeline script reduces flexibility and maintainability. Changes in one environment would force updates to the script itself, risking errors and breaking best practices.
- D. Incorrect.
Configuring long-lived or indefinite PATs is a security risk and falls short of Microsoft� best practices. Tokens should be renewed periodically to reduce the attack vector and ensure compliance with organizational security policies.