AZ-204 Practice Question: Connect to and consume Azure services and third-party services
You are developing a .NET Core application that uses Azure Service Bus queues. You need to implement a dead-lettering mechanism for messages that cannot be processed after 5 delivery attempts. Which property should you set on the queue to automate this?
⚠ Common exam trap
It's easy for candidates to confuse maxDeliveryCount with lockDuration, thinking that extending the lock gives more retries, but lockDuration only affects the time a single receive holds the message, not the total number of delivery attempts.
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
✓
maxDeliveryCount
The maxDeliveryCount property on an Azure Service Bus queue defines the maximum number of attempts to deliver a message before it is automatically moved to the dead-letter queue. Setting this property to 5 ensures that after five failed delivery attempts, the message is dead-lettered, meeting the requirement without custom code.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
defaultMessageTimeToLive
Why it's wrong here
defaultMessageTimeToLive specifies the maximum duration a message remains in the queue or topic before it is automatically moved to the dead-letter queue due to expiration, if dead-lettering on expiration is enabled. This property governs the overall lifespan of a message, ensuring it doesn't persist indefinitely if not consumed. However, it does not control the number of times a message is delivered to a consumer before being dead-lettered due to processing failures.
- ✓
maxDeliveryCount
Why this is correct
maxDeliveryCount is the crucial property that determines the maximum number of times a message can be delivered to a consumer before it is automatically moved to the dead-letter queue. Each time a message is received and then abandoned, or its lock expires without completion, the delivery count increments. Once this count exceeds maxDeliveryCount, the message is considered a "poison message" and is transferred to the dead-letter queue for manual inspection or alternative processing.
- ✗
lockDuration
Why it's wrong here
lockDuration defines the period during which a message is exclusively locked for processing by a consumer after it has been received in PeekLock mode. If the consumer fails to complete or abandon the message within this duration, the lock expires, and the message becomes available for re-delivery to another consumer. While an expired lock contributes to incrementing the delivery count, lockDuration itself does not directly set the threshold for dead-lettering based on delivery attempts; it merely influences when a message might become available for another attempt.
- ✗
requiresDuplicateDetection
Why it's wrong here
requiresDuplicateDetection is a queue or topic property that enables the Service Bus to detect and ignore duplicate messages sent within a specified time window. This feature is essential for ensuring exactly-once processing semantics by preventing the same message from being processed multiple times. However, it has no bearing on the mechanism of moving messages to the dead-letter queue when they fail to be processed successfully after a certain number of delivery attempts.
Go deeper
Related to this question
Learn chapter
Azure Functions Development
Key term
Azure Relay
Azure Relay is a cloud service that securely exposes on-premises web services to the public internet or other cloud applications without opening firewall ports.
Key term
Azure Service Bus
Azure Service Bus is a cloud-based message broker that allows applications, services, and devices to send and receive messages reliably, even when they are not all running at the same time.
About these practice questions
Courseiva writes every AZ-204 question from scratch — 881 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. 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.