401 SubCode=40100: Unauthorized : Unauthorized access for 'Send' operation on endpoint 'sb://

Yenier Jimenez 0 Reputation points
2023-05-15T16:28:31.29+00:00

I'm trying to send a message to a Bus Service - Topic using POSTMAN

And I got this error *401 SubCode=40100: Unauthorized : Unauthorized access for 'Send' operation on endpoint 'sb://

Azure Service Bus
Azure Service Bus
An Azure service that provides cloud messaging as a service and hybrid integration.
571 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MuthuKumaranMurugaachari-MSFT 22,256 Reputation points
    2023-05-18T19:59:54.0933333+00:00

    Yenier Jimenez Thanks for posting your question in Microsoft Q&A. Based on the exception, it looks like you got Unauthorized exception and don't have Send permission for the endpoint. Not sure if you are using SAS token or AD token (details are missing).

    User's image

    As described above screenshot, you can follow similar steps described in https://learn.microsoft.com/en-us/rest/api/servicebus/get-azure-active-directory-token and assign Service Bus Data Sender role for the app registration or identity if you use AD. For SAS token, follow the doc https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-sas and set the right Send for sending messages to the entity. You would face 401 Unauthorized error if there is an issue with the format of signature sent to Rest API.

    Also, would like to share similar discussion https://learn.microsoft.com/en-us/answers/questions/1199184/i-created-service-bus-with-the-queue-but-when-i-tr and article https://medium.com/javarevisited/send-message-to-azure-service-bus-via-postman-using-sas-token-in-1-step-a845686baad0 that might help with your case.

    If you still face the issue, share the full error message/exception, role/SAS token generation process etc. I hope this helps.


    If you found the answer to your question helpful, please take a moment to mark it as "Yes" for others to benefit from your experience. Or simply add a comment tagging me and would be happy to answer your questions.

    0 comments No comments