Ricardo de Vries
Ricardo de Vries

Reputation: 321

Using a managed identity with Azure Service Bus

I want to use a managed identity to connect to Azure Service Bus. In the docs they mention the DefaultAzureCredentialBuilder. I don't really get how this would use my managed identity to authenticate to the Service Bus.

Does anyone know this?

Upvotes: 0

Views: 1080

Answers (1)

Jesse Squire
Jesse Squire

Reputation: 7860

DefaultAzureCredential is a chained credential; internally it considers multiple authorization sources, including managed identities. More information can be found in the Azure.Identity overview.

Service Bus can use any of the Azure.Identity credentials for authorization. DefaultAzureCredentialBuilder is demonstrated only because it allows for success in a variety of scenarios.

If you'd prefer to restrict authorization to only a managed identity, you can do so by using ManagedIdentityCredentialBuilder rather than the default credential. An example of creating the can be found here. It can then be passed to Service Bus in the same manner as the default credential.

Upvotes: 1

Related Questions