AZ-400 Practice Question: Design and implement build and release pipelines
Exhibit
```
variables:
- group: ReleaseVariables
- name: EnvironmentName
value: Production
stages:
- stage: Deploy
jobs:
- deployment: DeployWeb
environment:
name: $(EnvironmentName)
resourceType: VirtualMachine
```Refer to the exhibit. The pipeline uses a variable group 'ReleaseVariables' that contains a variable named 'EnvironmentName' with value 'Staging'. What environment will the deployment target?
⚠ Common exam trap
Many candidates assume a variable group's variable named 'EnvironmentName' automatically sets the deployment environment, but the environment field in the YAML is a static value unless explicitly parameterized, so the explicit 'Production' value takes precedence.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Production
The pipeline uses a variable group 'ReleaseVariables' with a variable 'EnvironmentName' set to 'Staging', but the deployment job's environment field is explicitly set to 'Production' (as shown in the exhibit). Variable groups are used for sharing values across pipelines, but they do not override the environment specified directly in the YAML job definition. Therefore, the deployment target is 'Production'.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Staging
Why it's wrong here
The Staging value would only apply if the variable group's EnvironmentName were not overridden. However, pipeline-level variables take precedence over variable group variables in Azure Pipelines, so the Staging setting from the group is superseded.
- ✗
VirtualMachine
Why it's wrong here
VirtualMachine is a resource type in Azure Pipelines deployment jobs, used in deployment strategies to target VM instances for rolling deployments, not a logical environment name. The deployment job's environment is resolved from the EnvironmentName variable, which is set to Production at the pipeline level, overriding the variable group's Staging value. Since the environment name must be a string that identifies a specific environment resource, a resource type like VirtualMachine cannot be the targeted environment.
- ✓
Production
Why this is correct
Production is the correct environment because the pipeline defines EnvironmentName: Production at the root level, and in YAML pipelines, variables defined at the pipeline level take precedence over variables in variable groups when the same key exists. The variable group provides EnvironmentName=Staging, but the pipeline variable overrides it, causing the deployment job's environment reference $(EnvironmentName) to evaluate to Production. Therefore the deployment is targeted to the Production environment, not Staging.
- ✗
DeployWeb
Why it's wrong here
DeployWeb is merely the identifier of the deployment job in the pipeline, used only to organize tasks and conditions; it does not participate in environment resolution. The environment is selected by evaluating the environment property of the deployment job, which references the EnvironmentName variable. Even though the job is named DeployWeb, the variable evaluation yields Production after pipeline-level overrides, so DeployWeb is not the environment.
Visual reference
Go deeper
Related to this question
Learn chapter
Designing a Build Pipeline
Key term
Variable group
A variable group is a reusable collection of key-value pairs in Azure DevOps that can store configuration settings and secrets, shared across multiple pipelines.
Key term
Environment
An environment is a dedicated set of computing resources, configurations, and services used to develop, test, or host software applications in a controlled and repeatable way.
About these practice questions
One of 823 original AZ-400 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This AZ-400 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-400 exam.