Courseiva
Deploy and Manage Azure ComputemediumMultiple ChoiceObjective-mapped

AZ-104 Deploy and Manage Azure Compute Practice Question

A container group runs a nightly processing job in Azure Container Instances. The job should exit after completing successfully and should not restart automatically. Which restart policy should you configure?

⚠ Common exam trap

Many candidates confuse 'OnFailure' with 'Never' for successful jobs, not realizing that 'OnFailure' still restarts on failure, while the question requires no restart at all after successful completion.

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

Never

The 'Never' restart policy ensures that the container group runs once and does not restart after it exits, regardless of the exit code. This is ideal for a nightly batch job that should complete and then stop permanently without automatic restarts.

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

    The 'Always' restart policy is incorrect because Azure Container Instances will restart the container every time it exits, even after a successful run. For a nightly batch job, this would cause a continuous restart loop, consuming resources and preventing the job from being considered complete, as the container would never stay stopped.

    When this WOULD be correct

    A question where a container must run continuously and be restarted automatically if it stops for any reason, such as a web server or a long-running service that should always be available.

  • Never

    Why this is correct

    The 'Never' restart policy is correct for a nightly batch job because Azure Container Instances will run the container once to completion and then leave it in a stopped state without initiating any automatic restart, regardless of the exit code. This matches the expected lifecycle of a one-time processing workload that should not be relaunched after it finishes, either successfully or with an error.

  • OnFailure

    Why it's wrong here

    The 'OnFailure' restart policy is wrong because it would automatically restart the container only when the process exits with a non-zero exit code, indicating an error. The scenario explicitly states that no automatic restart is desired, so 'OnFailure' would violate that requirement by retrying failed runs, potentially causing unnecessary repeated executions of the nightly job.

    When this WOULD be correct

    A container group runs a data processing job that must restart only if it fails (e.g., due to transient errors). The job should not restart on success, but should retry on failure. 'OnFailure' would be correct.

  • Automatic

    Why it's wrong here

    The 'Automatic' restart policy is invalid because Azure Container Instances does not recognize a restart policy named 'Automatic.' The only supported restart policies are Always, OnFailure, and Never, so specifying 'Automatic' would be rejected during container group creation, making it impossible to deploy the job with that setting.

    When this WOULD be correct

    If the question asked about a restart policy for an Azure VM or a different service that supports an 'Automatic' restart policy (e.g., Azure VM Scale Sets with automatic repairs), then 'Automatic' could be correct. For example, 'Which restart policy ensures a VM is automatically restarted after a failure in a scale set?'

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

The 'Never' restart policy is correct for a nightly batch job because Azure Container Instances will run the container once to completion and then leave it in a stopped state without initiating any automatic restart, regardless of the exit code. This matches the expected lifecycle of a one-time processing workload that should not be relaunched after it finishes, either successfully or with an error.

AlwaysWrong answer — click to see why

Why this is wrong here

The 'Always' restart policy restarts the container regardless of exit code, which contradicts the requirement that the job should exit after completing successfully and not restart automatically.

★ When this WOULD be the correct answer

A question where a container must run continuously and be restarted automatically if it stops for any reason, such as a web server or a long-running service that should always be available.

Why candidates choose this

Candidates may confuse 'Always' with a default or safe option, assuming it ensures the job runs repeatedly, but they overlook the specific requirement for the job to exit and not restart.

OnFailureWrong answer — click to see why

Why this is wrong here

The job should exit after completing successfully and not restart. 'OnFailure' restarts the container only if it exits with a non-zero exit code (failure), but the question specifies the job completes successfully, so no restart is needed.

★ When this WOULD be the correct answer

A container group runs a data processing job that must restart only if it fails (e.g., due to transient errors). The job should not restart on success, but should retry on failure. 'OnFailure' would be correct.

Why candidates choose this

Candidates may think 'OnFailure' is appropriate because the job should not restart on success, but they overlook that the job is expected to succeed and exit, so no restart policy is needed at all.

AutomaticWrong answer — click to see why

Why this is wrong here

The 'Automatic' restart policy is not a valid option in Azure Container Instances; the valid policies are Always, Never, and OnFailure. Therefore, it cannot be configured for any container group.

★ When this WOULD be the correct answer

If the question asked about a restart policy for an Azure VM or a different service that supports an 'Automatic' restart policy (e.g., Azure VM Scale Sets with automatic repairs), then 'Automatic' could be correct. For example, 'Which restart policy ensures a VM is automatically restarted after a failure in a scale set?'

Why candidates choose this

Candidates may confuse the term 'Automatic' with the 'Always' policy or assume it is a valid option because it sounds like a logical default for automatic restarts.

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?”

About these practice questions

One of 1,049 original AZ-104 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 →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

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.