AZ-204 Practice Question: Connect to and consume Azure services and third-party services
You have an Azure Function app that processes messages from a Service Bus queue. The function uses the Service Bus trigger. You notice that under high load, some messages are processed multiple times. What is the most likely cause?
⚠ Common exam trap
Many exam-takers confuse message duplication with retry logic or delivery count, not realizing that the lock duration directly controls exclusive access and is the primary cause of duplicate processing under high load.
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
✓
The lock duration is too short for message processing time
The Service Bus trigger uses a lock mechanism to ensure that a message is processed exclusively by one function instance. If the lock duration is shorter than the time required to process the message, the lock expires before processing completes. This allows another consumer instance to acquire the lock and process the same message, leading to duplicate processing.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The queue is partitioned
Why it's wrong here
Partitioning an Azure Service Bus queue distributes messages across multiple message brokers to enhance scalability and throughput. While this design improves performance and availability, it does not inherently cause messages to be processed multiple times by consumers. Duplicates typically arise from issues related to message delivery guarantees or consumer processing failures, not from the physical distribution mechanism of the queue itself.
- ✓
The lock duration is too short for message processing time
Why this is correct
When an Azure Function processes a message from a Service Bus or Storage Queue, it acquires a lock on that message for a specified duration. If the function's execution time, including any retries or external service calls, exceeds this configured lock duration, the lock expires before the message is successfully completed. Consequently, the message is automatically released back into the queue, becoming available for another function instance (or even the same one) to pick up and process again, leading to duplicate processing.
- ✗
The batch size is too large
Why it's wrong here
Configuring a large batch size for an Azure Function trigger means that multiple messages are retrieved and processed concurrently within a single function invocation. While a very large batch size could potentially lead to timeouts or resource contention if not managed properly, it does not directly cause individual messages to be re-enqueued and processed multiple times. Each message within the batch is still subject to its own independent lock and completion mechanism, preventing it from being duplicated solely due to batching.
- ✗
The maxDeliveryCount is set too high
Why it's wrong here
The `maxDeliveryCount` property on a Service Bus queue or subscription determines the maximum number of times a message can be delivered to consumers before it is automatically moved to the dead-letter queue. While setting this value very high allows for numerous retries upon processing failures (e.g., unhandled exceptions), it does not, by itself, cause duplicate processing. Instead, it defines the tolerance for transient failures and how many attempts are made before a message is deemed unprocessable, rather than being the root cause of a message being processed concurrently or repeatedly due to an expired lock.
Go deeper
Related to this question
About these practice questions
One of 881 original AZ-204 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 →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
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.