An Azure service that provides cloud messaging as a service and hybrid integration.
Hi ,
Thanks for reaching out to Microsoft Q&A.
You cannot selectively dead-letter a single message when using batch (Cardinality.MANY) processing in an azure function with azure service bus. The batch is treated as one unit by the trigger runtime, so throwing an exception affects the entire batch, not individual messages.
If you need to move only the “bad” message to the DLQ, you have two practical options:
- Switch to single message processing (
Cardinality.ONE) – this gives you control per message. You can then explicitly dead-letter using the Service Bus SDK (ServiceBusReceiver.deadLetterMessage()), without impacting others.
Use SDK-based manual receive instead of trigger – receive messages via ServiceBusProcessorClient or ServiceBusReceiverClient, process them one by one inside your own loop, and explicitly call:
complete() for good messages
`deadLetter()` for bad messages
In short, batch trigger = no per-message DLQ control. For your scenario, move to per message handling (either via single trigger or SDK) to isolate and dead-letter only the problematic message.
Please 'Upvote'(Thumbs-up) and 'Accept' as answer if the reply was helpful. This will be benefitting other community members who face the same issue.