AZ-400 Practice Question: Design and implement build and release pipelines
Network Topology
Refer to the exhibit. You have a YAML pipeline that deploys an ARM template. The pipeline runs successfully on the first commit to main, but subsequent commits fail with 'The resource group myResourceGroup already exists'. How should you modify the pipeline to avoid this error?
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
✓
Add a condition to check if the resource group exists before creating it.
Adding a condition to check if the resource group exists before creating it avoids the error when the resource group already exists from a previous deployment. Options A, C, and D are incorrect: changing the location (A) does not prevent the existence error, using a different service connection (C) does not address resource group existence, and renaming the pipeline (D) triggers a new pipeline but does not affect resource group existence.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Change the location to a different region.
Why it's wrong here
Changing the location does not resolve the error because resource group names are unique within a subscription, not within a region. The pipeline is attempting to create a resource group with the same name that already exists in the subscription, so even if you specify a different region, Azure will still reject the creation if the name is already taken. Additionally, the deployment likely intends to reuse the existing resource group in eastus; creating a new one elsewhere would detach the pipeline from its intended target and potentially cause other configuration or policy mismatches.
- ✓
Add a condition to check if the resource group exists before creating it.
Why this is correct
Using an Azure CLI or PowerShell task condition such as `az group exists` (which returns a boolean) before invoking the resource group creation step makes the pipeline idempotent. If the resource group already exists, the creation task is skipped, preventing the 'The resource group already exists' error while still allowing subsequent deployment tasks to run.
- ✗
Use a different service connection for each deployment.
Why it's wrong here
A service connection defines the authentication context (e.g., service principal or managed identity) used to access Azure. Changing the connection does not alter the fact that the target resource group already exists; the error is due to an existing Azure resource, not insufficient permissions or an invalid connection.
- ✗
Rename the pipeline to trigger a clean build.
Why it's wrong here
Renaming a pipeline only changes its display name and doesn't modify the YAML definition, agent pool, or Azure resource state. A clean build also has no effect on resource group creation because the resource group is an Azure resource managed by the deployment tasks, not a build artifact or local file.
Go deeper
Related to this question
Learn chapter
Designing a Build Pipeline
Key term
YAML pipeline
A YAML pipeline is a text-based file written in YAML format that defines an automated series of steps for building, testing, and deploying software in a continuous integration and continuous delivery (CI/CD) system.
Key term
Check
A Check in Azure DevOps is a gating mechanism that evaluates predefined conditions before allowing a pipeline deployment to proceed to a specific environment.
About these practice questions
This AZ-400 question is part of Courseiva's 823-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
Same concept, more angles
1 more way this is tested on AZ-400
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. Refer to the exhibit. You run an ARM template deployment and get the error shown. What is the most likely cause?
medium- ✓ A.The template references a resource that already exists and conflicts with the deployment.
- B.The deployment name already exists in the resource group.
- C.The resource group location does not match the template location.
- D.The template has a syntax error in the JSON.
Why A: The error details show a Conflict with message 'User 'adminuser' already exists in this resource group.' This indicates the template tries to create a resource that already exists, causing a conflict.
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.