Reputation: 5805
I upgraded MassTransit to V7, and it seems there is a breaking change in connecting with Azure Service Bus. Previously, the code for creating an IBusControl
looked like this:
Bus.Factory.CreateUsingAzureServiceBus(cfg =>
{
cfg.Host(this.Host,
h =>
{
h.TokenProvider = TokenProvider.CreateSharedAccessSignatureTokenProvider(
"RootManageSharedAccessKey", this.AzureSharedAccessSignatureTokenKey);
});
...
This is not compiling anymore because the property TokenProvider
is no longer in IServiceBusHostConfigurator
.
What's the new way of providing the Service Bus access key?
Upvotes: 2
Views: 606
Reputation: 33278
The Azure SDK v7 uses TokenCredential
, which is the new way to specify credentials for all the various v7 SDKs. You can read about it in the documentation.
So for MassTransit, you'd set TokenCredential
to any of the supported credential types, e.g. DefaultAzureCredential
:
TokenCredential = new DefaultAzureCredential();
Upvotes: 0
Reputation: 5805
In V7, the shared access token can be specified in the property NamedKeyCredential
. So instead of h.TokenProvider = ...
, we write:
h.NamedKeyCredential = new AzureNamedKeyCredential(
"RootManageSharedAccessKey",
this.AzureSharedAccessSignatureTokenKey);
Upvotes: 2