Question 2 of 881
AZ-204 Develop Azure compute solutions Practice Question
You are developing a serverless application using Azure Functions that processes order messages from an Azure Service Bus queue. Each order message is approximately 64 KB in size. The function must process messages in order and exactly once. The current implementation uses a Service Bus trigger with batch processing enabled. You notice that occasionally duplicate messages are processed. You need to ensure exactly-once processing while maintaining message ordering. What should you do?
⚠ Common exam trap
Test-takers frequently confuse disabling batch processing or increasing lock duration with solving duplicate processing, but these do not address the root cause of duplicate deliveries; only session-based or duplicate detection mechanisms guarantee exactly-once processing with ordering.
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
✓
Enable sessions on the Service Bus queue and update the function trigger to use sessions.
Enabling sessions on the Service Bus queue and using a session-enabled trigger guarantees message ordering and exactly-once processing. Sessions group related messages into a logical sequence, and the Service Bus trigger locks the entire session, ensuring that messages within a session are processed in order and that no other consumer can process the same session concurrently. This prevents duplicate processing while maintaining the required ordering.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Disable batch processing in the function trigger and process messages one at a time.
Why it's wrong here
Disabling batch processing in the Azure Function trigger means the function will process messages individually rather than in groups. While this might simplify individual message handling logic, it does not inherently prevent duplicate message delivery from Azure Service Bus. Service Bus guarantees "at-least-once" delivery, meaning a message can be redelivered if its lock expires or the function fails to complete it, regardless of whether it was part of a batch or processed singularly.
- ✓
Enable sessions on the Service Bus queue and update the function trigger to use sessions.
Why this is correct
Enabling sessions on the Azure Service Bus queue and configuring the Azure Function trigger to utilize them is the most effective solution for achieving exactly-once processing. Service Bus sessions provide a mechanism for ordered handling of related messages and ensure that only one receiver processes messages for a specific session at any given time. This unique receiver lock, combined with the ability to maintain session state, effectively prevents duplicate processing and ensures messages are handled sequentially within their logical grouping.
- ✗
Increase the lock duration on the Service Bus queue to 5 minutes.
Why it's wrong here
Increasing the lock duration on the Service Bus queue to 5 minutes extends the time an Azure Function has to process a message before its lock automatically expires. While a longer lock duration reduces the probability of a message being redelivered due to processing delays or transient failures, it does not guarantee exactly-once processing. If the function fails to complete the message within the extended lock duration, or if the function crashes without completing it, the message will still eventually become available for redelivery, potentially leading to duplicates.
- ✗
Set the maxDeliveryCount property on the queue to 1.
Why it's wrong here
Setting the maxDeliveryCount property on the Service Bus queue to 1 dictates that a message will be moved to the dead-letter queue after its first delivery attempt if it's not successfully completed. While this limits the number of retries for a *failed* message, it does not prevent duplicate processing in scenarios where a message is successfully delivered and processed by a function, but the acknowledgment of completion is lost or delayed, causing Service Bus to redeliver the *same* message. This property primarily manages retry policies for transient failures, not inherent duplicate delivery prevention.
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.