Question 574 of 881
AZ-204 Develop Azure compute solutions Practice Question
You are developing a containerized application that will be deployed to Azure Container Instances (ACI). The application consists of a web front-end and a background worker that processes messages from an Azure Storage Queue. You need to ensure that the worker container runs continuously and processes messages as they arrive. The solution must minimize cost and management overhead. What should you do?
⚠ Common exam trap
The trap here is that candidates mistakenly choose the OnFailure restart policy (Option C) thinking it will restart the container after each message, but they overlook that a successful exit (exit code 0) does not trigger a restart, causing the worker to stop after processing one message.
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
✓
Deploy the worker as a container group in ACI with the restart policy set to Always.
ACI with a restart policy of Always ensures the worker container restarts immediately after it finishes processing a message, allowing it to continuously poll the Azure Storage Queue for new messages. This minimizes cost by using a serverless container model without provisioning VMs or managing orchestration, and it reduces management overhead compared to alternatives like Azure virtual machines.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use Azure Container Apps with a scale rule that triggers on queue length.
Why it's wrong here
Azure Container Apps introduces an orchestrator and scaling controller that, while capable of queue-length-based scaling, adds management overhead and cost from the underlying Kubernetes-style infrastructure, which contradicts the requirement to minimise both. It is tempting because its built-in scale rule on queue length directly addresses the need to process messages as they arrive, making it the correct choice when the application requires automatic scaling to zero and fine-grained per-replica scaling, rather than the always-on, single-instance worker that ACI provides.
- ✗
Run the worker inside an Azure virtual machine with a container runtime.
Why it's wrong here
Running a containerized worker inside an Azure Virtual Machine (VM) with a container runtime introduces significant management overhead. This approach requires the user to provision, patch, and secure the underlying operating system, as well as install and maintain the container runtime environment (e.g., Docker). For a single container, this infrastructure management and the associated compute/storage costs are disproportionately high compared to serverless container options, making it an inefficient choice.
- ✗
Deploy the worker as a container in ACI with the restart policy set to OnFailure.
Why it's wrong here
The `OnFailure` restart policy in Azure Container Instances (ACI) is designed for tasks that should only be retried if they terminate with a non-zero exit code, indicating an error. If the worker process successfully completes its current task and exits with a zero exit code, ACI will consider the container's job finished and will not restart it. This behavior is unsuitable for a continuously running worker that needs to remain active indefinitely to process new messages as they arrive.
- ✓
Deploy the worker as a container group in ACI with the restart policy set to Always.
Why this is correct
Deploying the worker as a container group in Azure Container Instances (ACI) with the restart policy set to `Always` is the most appropriate solution. ACI offers a serverless platform, eliminating the need to manage underlying virtual machines or orchestration infrastructure. The `Always` restart policy ensures that the container is automatically restarted by ACI if it stops for any reason, guaranteeing continuous availability for the worker process to handle incoming messages efficiently and cost-effectively.
Quick reference
Cloud Service Model Comparison
| Model | You Manage | Provider Manages | Examples |
|---|---|---|---|
| IaaS | OS, runtime, apps, data | Hardware, hypervisor, networking | EC2, Azure VMs, GCP Compute Engine |
| PaaS | Apps and data | OS, runtime, middleware, hardware | Elastic Beanstalk, Azure App Service |
| SaaS | Data and settings only | Everything else | Microsoft 365, Salesforce, Workday |
| FaaS / Serverless | Function code only | Infra, scaling, runtime | Lambda, Azure Functions, Cloud Run |
| CaaS | Containers and apps | Kubernetes, OS, hardware | EKS, AKS, GKE |
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 →
Last reviewed: Jun 24, 2026
This AZ-204 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-204 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.