CustomProvider CreateManagedServiceIdentityTokenProvider

Let me clarify.

There’s no need to include the reference to Microsoft.Azure.Services.AppAuthentication. It’s a dependency for Azure Service Bus SDK/client which is transitively brought into your project when the ASB transport is used.

The combination of the connection string (w/o key and token) and a specified TokenProvider should work.

The connection string with the Authentication=Managed Identity part is necessary when the application is compiled to work with the ASB transport that is configured using connection string only and the code cannot be updated and redeployed (ServiceControl for example).

To sum it up, there are two options:

  1. Use connection string and specify the authentication option in the connection string.
  2. Provide the connection string with the namespace FQDN and in the code register a token provider.

Hope that clarifies this.