AZ-104 Deploy and Manage Azure Compute Practice Question
This AZ-104 practice question tests your understanding of deploy and manage azure compute. This is a configuration task: choose the command set that satisfies every stated requirement. Small differences — like 'secret' vs 'password' or 'transport input ssh' vs 'all' — change whether the answer is correct. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
Exhibit
Container group configuration:
- Name: cg-nightly-import
- Container image: contoso.azurecr.io/importer:1.2
- Job behavior: the process imports files, exits with code 0 on success, and should not run again until the next scheduled deployment
- Requirement: do not restart the container after successful completion
Based on the exhibit, which restart policy should be configured for the container group?
Exhibit
Container group configuration:
- Name: cg-nightly-import
- Container image: contoso.azurecr.io/importer:1.2
- Job behavior: the process imports files, exits with code 0 on success, and should not run again until the next scheduled deployment
- Requirement: do not restart the container after successful completion
A
Always
Why wrong: Always would restart the container even after successful completion, which conflicts with the one-time job requirement.
B
OnFailure
Why wrong: OnFailure restarts when the container exits with an error, but the job should not restart after success either.
C
Never
Never is the correct restart policy for a one-time task that should stop after finishing successfully. The exhibit describes a batch-style import job, not a long-running service. Using Never ensures the container exits and stays stopped until the next deployment or scheduled run. That behavior matches operational expectations for a completed import process.
D
UnlessStopped
Why wrong: UnlessStopped is not the right ACI behavior for a completed one-time task and would imply continued restart behavior.
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Never
The container group in the exhibit is configured with a restart policy of 'Never' because it is designed to run a batch job that should execute once and then terminate. Azure Container Instances supports three restart policies: Always, OnFailure, and Never. Since the task is a one-time job, 'Never' ensures the container does not restart after completion, which is the correct choice for a single-run workload.
Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
✗
Always
Why it's wrong here
Always would restart the container even after successful completion, which conflicts with the one-time job requirement.
When this WOULD be correct
For a container group running a long-lived service like a web server that must be automatically restarted after any crash or stop, 'Always' is correct.
✗
OnFailure
Why it's wrong here
OnFailure restarts when the container exits with an error, but the job should not restart after success either.
When this WOULD be correct
A container group runs a batch processing job that should automatically restart only if it fails (non-zero exit code). For example, a data transformation task that must be retried upon failure until success.
✓
Never
Why this is correct
Never is the correct restart policy for a one-time task that should stop after finishing successfully. The exhibit describes a batch-style import job, not a long-running service. Using Never ensures the container exits and stays stopped until the next deployment or scheduled run. That behavior matches operational expectations for a completed import process.
Related concept
Read the scenario before looking for a memorised answer.
✗
UnlessStopped
Why it's wrong here
UnlessStopped is not the right ACI behavior for a completed one-time task and would imply continued restart behavior.
When this WOULD be correct
In a Docker environment (not Azure Container Instances), 'UnlessStopped' is a valid restart policy. An exam question about Docker container restart policies where the container should restart unless explicitly stopped would have 'UnlessStopped' as the correct answer.
Option-by-option analysis
Why each answer is right or wrong
Understanding why wrong answers are wrong — and when they would be correct — is what separates a 750 score from a 900. The AZ-104 exam frequently reuses these exact scenarios with slightly different constraints.
✓NeverCorrect answer▾
Why this is correct
Never is the correct restart policy for a one-time task that should stop after finishing successfully. The exhibit describes a batch-style import job, not a long-running service. Using Never ensures the container exits and stays stopped until the next deployment or scheduled run. That behavior matches operational expectations for a completed import process.
✗AlwaysWrong answer — click to see why▾
Why this is wrong here
The exhibit shows a container group that runs a batch job; 'Always' would cause the container to restart indefinitely even after successful completion, which is not desired for a one-time task.
★ When this WOULD be the correct answer
For a container group running a long-lived service like a web server that must be automatically restarted after any crash or stop, 'Always' is correct.
Why candidates choose this
Candidates may think 'Always' is the default or safest restart policy, not realizing that for batch jobs or tasks that should run once, 'Never' or 'OnFailure' is appropriate.
✗OnFailureWrong answer — click to see why▾
Why this is wrong here
The container group is designed for a single-run task (e.g., a batch job) that must not restart after completion. OnFailure would restart the container if it exits with a non-zero code, but the task is expected to succeed and should not restart even on failure.
★ When this WOULD be the correct answer
A container group runs a batch processing job that should automatically restart only if it fails (non-zero exit code). For example, a data transformation task that must be retried upon failure until success.
Why candidates choose this
Candidates often associate OnFailure with batch jobs that need retry on error, but overlook that the question's exhibit shows a task that must not restart under any condition, making Never the correct choice.
✗UnlessStoppedWrong answer — click to see why▾
Why this is wrong here
The question asks for a restart policy for a container group, and 'UnlessStopped' is not a valid restart policy for Azure Container Instances; the valid options are Always, Never, and OnFailure.
★ When this WOULD be the correct answer
In a Docker environment (not Azure Container Instances), 'UnlessStopped' is a valid restart policy. An exam question about Docker container restart policies where the container should restart unless explicitly stopped would have 'UnlessStopped' as the correct answer.
Why candidates choose this
Candidates may confuse Docker restart policies with Azure Container Instances policies, or they might think 'UnlessStopped' is a more flexible version of 'Always' that stops restarting when the container is manually stopped.
Analysis generated from the official AZ-104blueprint and verified against question context. The “when correct” sections are what AI assistants cite when candidates ask “what’s the difference between these options?”
Common exam traps
Common exam trap: answer the scenario, not the keyword
The trap here is that candidates confuse Docker's native restart policies (which include 'UnlessStopped') with Azure Container Instances' supported policies, leading them to select 'UnlessStopped' even though it is not available in ACI.
Detailed technical explanation
How to think about this question
Azure Container Instances restart policies are enforced at the container group level and map to Docker's restart policies but with limited options: Always (equivalent to Docker's 'always'), OnFailure (equivalent to Docker's 'on-failure'), and Never (equivalent to Docker's 'no'). When a container group is set to 'Never', the container runs once and stops; the group remains in a 'Stopped' state until manually deleted or restarted. This is ideal for batch processing, data migration, or one-time scripts where restarting would cause duplicate work or errors.
KKey Concepts to Remember
Read the scenario before looking for a memorised answer.
Find the constraint that changes the correct option.
Eliminate answers that are true in general but not in this case.
TExam Day Tips
→Watch for words such as best, first, most likely and least administrative effort.
→Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Real-world example
How this comes up in practice
A cloud solutions architect for a retail company is evaluating services for a new workload. The correct answer here reflects best practice for the specific scenario described — not a general cloud recommendation. Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option. Cloud exam questions reward reading the constraint carefully: the same technology can be right or wrong depending on the use case.
Related glossary terms
Concepts from this question explained
These glossary pages explain the core terms tested in this AZ-104 question in full detail.
Deploy and Manage Azure Compute — This question tests Deploy and Manage Azure Compute — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: Never — The container group in the exhibit is configured with a restart policy of 'Never' because it is designed to run a batch job that should execute once and then terminate. Azure Container Instances supports three restart policies: Always, OnFailure, and Never. Since the task is a one-time job, 'Never' ensures the container does not restart after completion, which is the correct choice for a single-run workload.
What should I do if I get this AZ-104 question wrong?
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
What is the key concept behind this question?
Read the scenario before looking for a memorised answer.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
This AZ-104 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-104 exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.