'How do I access the AZ Service Bus without a SAS Key

I need help in creating access to AZ a service bus without using thr Shared Access Key in an Azure Function. When I use the Endpoint, SharedAccessKeyName, SharedAccessKey, QueueName and RuleName it works great! I can create the connection string like this:

string connectionString = string.Format("Endpoint={0};SharedAccessKeyName={1};SharedAccessKey={2}", Endpoint, SharedAccessKeyName, SharedAccessKey);

Manager = new Azure.Messaging.ServiceBus.Administration.ServiceBusAdministrationClient(connectionString);

I was told that I can use the AZ Identity to accomplish this same thing without the SAS Key. I have not been able to figure out how to do this. In fact, I do not even know where to begin.



Solution 1:[1]

You can make your app to run under a managed Identity, and then configure your Azure Service Bus resource to allow access for that identity. See the documentation and the sample code here.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Anand Sowmithiran