Get message from a Service Bus topic using a Azure AD JWT using AMQP.Net Lite

Emil Ræbild Bolet 1 Reputation point
2021-04-20T14:05:18.07+00:00

Hi is it possible to use an Azure AD JWT to get messages from an Azure Service Bus topic through AMQP.Net Lite? We would like to manage who can access our Service bus topic by using Azure RBAC.
I have looked at https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-sas#use-the-shared-access-signature-at-amqp-level but it seems like its only possible with SAS tokens.

I have created an example(https://github.com/emilbolet/azure-servicebus-amqp-rbac) using the Microsoft.Azure.ServiceBus library however it is critical that we use a generic AMQP library.

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

1 answer

Sort by: Most helpful
  1. Clemens Vasters 16 Reputation points Microsoft Employee
    2021-04-20T16:07:19.907+00:00

    AMQP.Net Lite has a "CBS" sample that is important for this. You need to use the CBS mechanism to set these tokens. The sample shows SAS, you can use JWT instead: https://github.com/Azure/amqpnetlite/blob/master/Examples/ServiceBus/Scenarios/CbsAsyncExample.cs

    To acquire the JWT, you need to request access to "https://servicebus.azure.net/.default" on AAD.

    https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-managed-service-identity#overview

    3 people found this answer helpful.