az-400 Practice Question 1978

Exam: az-400
Domain: Design and implement build and release pipelines
Topic: Design and implement continuous integration
Difficulty: medium
When designing a CI/CD pipeline in Azure Pipelines, you need to ensure that the test automation scripts run on a self-hosted agent before deploying to production. Which YAML snippet correctly configures this requirement in a multi-stage pipeline?

Answer Options

A
- stage: Test jobs: - job: Tests pool: name: 'Default Agent Pool' steps: - script: echo Testing...
B
- stage: Test jobs: - job: Tests pool: name: 'SelfHostedAgentPool' steps: - script: echo Testing...
C
- stage: Test jobs: - job: Tests pool: name: 'MySelfHostedAgents' steps: - script: echo Testing...
D
- stage: Test jobs: - job: Tests pool: name: 'SelfHostedAgentsPool' steps: - script: echo Testing...

Correct Answer

B: - stage: Test jobs: - job: Tests pool: name: 'SelfHostedAgentPool' steps: - script: echo Testing...

Explanation

The correct answer is B because it specifies the use of a self-hosted agent pool for the test stage, ensuring that the test automation scripts run on a dedicated environment before deployment. Option A is incorrect because it does not specify the agent pool, which could lead to the use of any available agent. Option C is incorrect because it incorrectly names the agent pool, which would cause errors. Option D is incorrect because it does not specify the agent pool and uses an invalid syntax.

Related Practice Questions