AZ-400 Question 125
Select 2Your organization uses Azure DevOps with multiple microservices stored across separate repositories. You need to design a pipeline solution that ensures each microservice pipeline triggers automatically on new commits to its respective repository while reusing the same build, test, and deployment logic from a central location. Which two actions should you implement?
- A
Create an Azure DevOps pipeline template containing the shared logic, then extend this template from each microservice repository� pipeline YAML.
- B
Configure CI triggers in each microservice repository pipeline to run whenever changes are pushed to its dedicated branch.
- C
Use a single pipeline in a shared repository that directly references source code from all microservices with path-based filters for each microservice.
- D
Duplicate the shared pipeline file in every microservice repository so each pipeline is fully self-contained and runs independently.
- E
Move all microservices into a single repository to reduce duplication and invoke one consolidated pipeline.
Show answer and explanation
Correct answers: A, B
Explanation
In Azure DevOps, designing pipelines to reuse shared logic while keeping each microservice's pipeline independent is achieved through pipeline templates and proper triggers. By creating a central template, you avoid duplicating build, test, and deployment steps in every repository. Meanwhile, enabling continuous integration triggers in each microservice repository ensures that each pipeline runs automatically upon new commits. This approach aligns with Microsoft DevOps best practices. For more details, see the official Azure DevOps documentation on templates and CI triggers at https://learn.microsoft.com/azure/devops/pipelines/process/templates.
- A. Correct.
Correct. By placing the common tasks (e.g., build, test, deployment steps) in a shared pipeline template, you reduce duplication and maintain consistency across microservices. Each repository pipeline can reference and extend this template, simplifying updates and version control for common tasks.
- B. Correct.
Correct. Enabling continuous integration triggers ensures that each microservice pipeline runs automatically on new commits or pull requests to its respective repository. This meets the requirement for automatic pipeline execution whenever a microservice� code changes.
- C. Incorrect.
Incorrect. While you could create a single pipeline and reference all repositories, it becomes difficult to isolate individual microservice triggers and maintain modularity. Each microservice should have its own pipeline, even if they share common logic through templates.
- D. Incorrect.
Incorrect. Duplicating files across repositories makes updates cumbersome and prone to human error. Centralizing shared logic in a common template repository is a more efficient and maintainable practice.
- E. Incorrect.
Incorrect. Consolidating all microservices into a single repository does not align with microservice best practices, which promote separate repos for independent updates and deployments.