Is there a way to delete DLQ messages under topic subscription azure servicebus through powershell script

169 Views Asked by At

Am planning to develop an powershell script to delete DLQ messages under Azure servicebus topic subscription, however i could not find any powershell cmdlet to delete the DLQ messages and when i referred some documents it says its not possible to delete the DLQ messages via powershell as it doesnt have any right cmdlet to delete it , so i tried lets try with Restapi method but i couldnt find accurate restapi. So I have these question

  1. Can i use powershell script to delete dlq messages? or
  2. Which Restapi can i use for it .

Any suggestion on this is much apprciated. Am eager to write powershell scriot but want to know is it possible ? Please note : Am not expert in ps script but i write some basic scripts

Thanks in Advace

1

There are 1 best solutions below

0
Jahnavi On

Can I use PowerShell script to delete dlq messages?

There is no possibility of using PowerShell script to delete dql messages.

Refer Microsoft Q&A for detailed information on the above approach.

Which Restapi can I use for it?

You can use the Rest API with URL https://<serviceNamespace>.servicebus.windows.net/<queuePath>/messages/head for Delete request as given in the MS Doc.

Or

You can also use service bus explorer under Azure service bus from the Portal as shown.

enter image description here

Refer SO by @Thili for another approach which is using service bus explorer tool to deleted dlq messages.