Closed Ilincescu closed 1 year ago
It should be working with managed identity, yes.
Could you maybe post the entire exception? (i.e. including inner exceptions and call stack etc)
I also have the same problem and do not yet understand the reason. Even though identity is configured
Source: using var bus = Configure .With(new BuiltinHandlerActivator()) .Transport(t => t.UseAzureServiceBus("namespace.servicebus.windows.net", "queue-name", new DefaultAzureCredential())) .Routing(r => r.TypeBased().Map
Exception: Exception while executing function: FunctionConvertPdf Could not resolve Rebus.AzureServiceBus.AzureServiceBusTransport with decorator depth 0 - registrations: Rebus.Injection.Injectionist+Handler Could not interpret 'namespace.servicebus.windows.net' as a key-value pair
This part:
(...) Could not interpret 'doclanrenewal.servicebus.windows.net' as a key-value pair (...)
means that the string "doclanrenewal.servicebus.windows.net"
could not be interpreted as a connection string.
You need to pass a string on the form "Endpoint=<something something>"
e.g. like "Endpoint=sb://doclanrenewal.servicebus.windows.net;<more stuff here>"
But I want to use identity instead of root key in connectionString. If I use connectionString is "Endpoint=sb://namespace.servicebus.windows.net/;Authentication=ManagedIdentity" then exception: Exception while executing function: FunctionConvertPdf Could not resolve Rebus.AzureServiceBus.AzureServiceBusTransport with decorator depth 0 - registrations: Rebus.Injection.Injectionist+Handler The value 'Endpoint=sb://namespace.servicebus.windows.net/;Authentication=Managed Identity' is not a well-formed Service Bus fully qualified namespace. (Parameter 'fullyQualifiedNamespace')
How about just using
.UseAzureServiceBus("Endpoint=sb://doclanrenewal.servicebus.windows.net", "queue-name", new DefaultAzureCredential())
?
I still get the same error as above
Any chance you could post the full exception details?
I resolved to be the problem. The reason for this exception is the version of rebus. After I updated to the latest version then it worked for me. Thanks
Ok, good to hear! 🙂
So to sum it up, this works:
var connectionString = "Endpoint=namespace.servicebus.windows.net";
var queueName = "queue-name";
using var bus = Configure.With(new BuiltinHandlerActivator())
.Transport(t => t.UseAzureServiceBus(connectionString, queueName , new DefaultAzureCredential()))
.Routing(r => r.TypeBased().Map(Constants.DocumentVersionUpdatedPdfEto))
.Start();
await bus.Publish(documentVersionUpdateEto, headers);
I tried to use the UseAzureServiceBus with managed identity and send the TokenCredential. I tested using the local azure user from visual studio that I gave permission (in the IAM) to the Service Bus Namespace. But I get an Rebus.Injection.ResolutionException exception with the message : DefaultAzureCredential failed to retrieve a token from the included credentials.
The Rebus.AzureServiceBus is working with managed identity ?