1

Currently we use Service Bus Explorer to connect to our Service Bus Namespace and manage our dead letters. However as this is a third party tool it's been asked that we do not use this anymore as there is a lot of sensitive data being pulled from the dead letters.

We do not get many dead letter messages in the queues so we thought it would be great if we can view the payload of a dead letter directly in Azure CLI or Powershell. I have looked around online and can't seem to find anything in regards to viewing payloads in CLI. Everything seems to recommend using Service Bus Explorer for viewing payloads.

Any help on this would be greatly appreciated.

cress89
  • 15
  • 4
  • If you are very much concerned about privacy then I would highly suggest using [Serverless360](https://www.serverless360.com/request-demo) which is compliant to GDPR and also you got a private Hosting option that can be deployed to your own environment using your own databases. – Nadeem Duke Feb 15 '20 at 14:58

3 Answers3

3

Azure CLI for Service Bus is intended to manage service namespace, entities, and control plane (authorization rules, Geo-DR, namespace migration, etc). It is not intended for the data plane. Just as you wouldn't do expect a DB (MariaDB) to provide commands for data manipulation.

You've got two options:

  1. Use a tool
  2. Write custom script/code (which is a way of building a custom tool)

For tooling, you've got a few options: ServiceBus Explorer (free), QueueExplorer (paid), Serverless360 (subscription), etc.

If you choose to write your own code, you could use PowerShell and leverage .NET SDK. Or create your own project/tool to help you inspect and move those dead-lettered messages.

Remember that operating on messages in a dead-letter queue is no different from consuming messages from a regular queue/subscription. It's the path that is slightly different. There's the official documentation on the topic as well as some more extended information on the web. I've posted a few blog posts that could help you work with dead-letter queues more effectively:

If you're using NServiceBus with Azure ServiceBus, you can leverage Service Pulse to achieve monitoring and inspection with a custom plugin. Here's a post.

For a pure code solution, this sample could be a good starting point.

Sean Feldman
  • 23,443
  • 7
  • 55
  • 80
1

Looking at both latest Azure PowerShell Cmdlets (v6.13.0) and Azure CLI, it seems that the functionality you're looking for is not available. The functionality available at both places are for managing Azure Service Bus control plane and not the data plane.

Regarding Service Bus Explorer, even though it's a 3rd party tool, it's an open source tool and you can see what exactly it does. Furthermore, it's a desktop tool so the tool directly communicates with your Service Bus.

However if using Service Bus Explorer is not an option, I guess you're left with writing code using any available SDKs.

Gaurav Mantri
  • 128,066
  • 12
  • 206
  • 241
0

Peeking of dead lettered messages (and normal messages for that matter) are now supported from within the Azure Portal. Since you mentioned that you don't get many dead letter messages in your queues this might be a good solution for you.

The section in the documentation explaining how to Peek a message also mentions that the message body/payload can be displayed. For messages over 1MB the message body/payload is not automatically displayed (for performance reasons). There will however be a Load message body button you can click to load it one-by-one.

You might also be interested in re-sending the messages to the original queue which is now also supported from within the Azure Portal.

The section in the documentation explaining how to Re-send a message gives some background, but it doesn't specifically mention re-sending of dead lettered messages.

Steps:

  1. Browse to the relevant queue (Service Bus -> Queues -> Specific queue)
  2. Select Service Bus Explorer (preview) in the left-hand-side menu
  3. Change from Peek mode to Receive mode
  4. Select the Dead-letter tab
  5. Click Receive Messages (right-hand side-bar opens)
  6. Select ReceiveAndDelete as the Receive Mode
  7. Specify the Number of messages to receive
  8. Click the Receive button on the right-hand side-bar (not visible in screenshot)
  9. The messages are displayed in a list
  10. Select the messages that you want to re-send to the normal queue
  11. Click Re-send selected messages (it should not be greyed-out as in screenshot)
  12. You can confirm that the messages were successfully resent under Notifications

Note that it's also possible to do the same in Peek mode, but then the messages will not be removed from the dead letter queue (DLQ).

Service Bus Explorer (preview)

enter image description here

HeatZync
  • 160
  • 1
  • 10