Question 315 of 881
AZ-204 Develop Azure compute solutions Practice Question
You are developing an Azure Function that uses a Service Bus queue trigger. You need to ensure that the function processes messages one at a time to guarantee order. Which configuration should you use?
⚠ Common exam trap
Watch out — candidates often confuse `batchSize` (which controls how many messages are fetched at once) with `maxConcurrentCalls` (which controls how many parallel executions are allowed), and incorrectly assume that setting `maxConcurrentCalls` to 1 in the trigger attribute is the solution, but the attribute does not have a `maxMessages` property.
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
✓
Set the batchSize to 1 in host.json
Setting `batchSize` to 1 in `host.json` forces the Service Bus trigger to process only one message at a time from the queue. This ensures strict message ordering, as the function will not fetch or process the next message until the current one is completed (either successfully or moved to the dead-letter queue). The Service Bus trigger uses a message pump that respects the `batchSize` setting to control concurrency.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Set the batchSize to 1 in host.json
Why this is correct
Setting the `batchSize` to `1` within the `host.json` file for the Service Bus trigger ensures that the Azure Function runtime processes only one message per function invocation. This configuration is crucial when strict message ordering or atomicity for individual messages is required, preventing the function from receiving multiple messages in a single batch. It directly controls the maximum number of messages the trigger will attempt to retrieve and process concurrently within one execution, effectively disabling batching.
- ✗
Set the maxMessages to 1 in the ServiceBusTrigger attribute
Why it's wrong here
The `maxMessages` property is not a valid or recognized attribute for the `ServiceBusTrigger` in Azure Functions. Trigger attributes are primarily used to define connection strings, queue or topic names, and access rights, not for controlling runtime batching behavior. Configuration settings like message batching are managed at the host level within the `host.json` file, which governs the overall runtime behavior of the function app.
- ✗
Set the function to run on a Premium Plan
Why it's wrong here
Running an Azure Function on a Premium Plan provides enhanced hosting capabilities such as pre-warmed instances, VNET integration, and longer execution durations, but it does not inherently control message batching behavior for triggers. The Premium Plan focuses on performance, scalability, and network features, not on the specific message processing logic of individual triggers. Therefore, upgrading the plan does not automatically configure the Service Bus trigger to process only one message at a time.
- ✗
Set the maxDequeueCount to 1 in host.json
Why it's wrong here
The `maxDequeueCount` property in `host.json` is designed to specify the maximum number of times a message can be dequeued and processed unsuccessfully before it is automatically moved to a dead-letter queue. Setting this to `1` would mean any single processing failure immediately dead-letters the message, which is distinct from controlling the number of messages received per invocation. This property manages retry logic and error handling, not the batch size of incoming messages.
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 11, 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.