AZ-400 · Question #599
Hotspot Question You have an Azure DevOps organization that contains a build job. The job is configured by using a pipeline named Pipeline1. You need to run the job on multiple operating system images
The correct answer is First YAML key selection: strategy:; Second YAML key selection: matrix:. This question tests knowledge of Azure DevOps YAML pipeline configuration for running jobs across multiple operating system images using a matrix strategy.
Question
Exhibit
Answer Area
- First YAML key selectionstrategy:container:deployment:matrix:strategy:uses:
- Second YAML key selectionmatrix:container:deployment:matrix:strategy:uses:
Explanation
This question tests knowledge of Azure DevOps YAML pipeline configuration for running jobs across multiple operating system images using a matrix strategy.
Approach. To run a job on multiple OS images in Azure DevOps YAML pipelines, you use the 'strategy' keyword with 'matrix' to define multiple configurations, and 'vmImage' under 'pool' to reference the matrix variable. The correct structure uses 'strategy: matrix:' to define named configurations (e.g., linux, windows, mac) each with an 'imageName' variable, then sets 'pool: vmImage: $(imageName)' to dynamically select the image. The YAML should look like: 'strategy: matrix: linux: imageName: ubuntu-latest windows: imageName: windows-latest' and 'pool: vmImage: $(imageName)'. This causes Azure DevOps to spin up parallel jobs for each matrix entry, each running on the specified OS image.
Concept tested. Azure DevOps YAML pipeline matrix strategy for multi-platform job execution using 'strategy: matrix' combined with dynamic 'pool: vmImage' variable references to run the same job across multiple operating system images simultaneously.
Reference. https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops#matrix
Topics
Community Discussion
No community discussion yet for this question.
