Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New AzureServiceBusTransport Constructor Not Setting Fully Qualified Namespace when Injecting an IFunctionEndpoint #369

Closed
sanfordn opened this issue Aug 24, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@sanfordn
Copy link

Describe the bug

Description

Within the UseNServiceBus() configuration section, we are using the "newer" constructor for building an AzureServiceBusTransport with a DefaultAzureCredential token. We followed the steps in the documentation for moving from Version 2 to Version 3 as it was specifically called out how we can specify a DefaultAzureCredential as the TokenCredential.

It seems to build the EndpointConfiguration just fine when inside of our startup file, but once we get to our Sender, it puts the Fully qualified service bus name into the ConnectionString property of the IFunctionEndpoint implementation.

Expected behavior

When using the constructor where you can specify a fully qualified namespace, the FullyQualifiedNamespace hosts whatever value is passed into it throughout the lifetime of the service.

Actual behavior

Once we get into the Sender, the FullyQualifiedNamespace variable is empty in the EndpointConfiguration, and we get an error after we do a RouteToThisEndpoint() and IFunctionEndpoint.Send() saying
The value '' is not a well-formed Service Bus fully qualified namespace. (Parameter 'fullyQualifiedNamespace. And the FullyQualifiedNamespace value that we passed in the Startup is inside the ConnectionString property

Versions

NServiceBus.AzureFunctions.Worker.ServiceBus 4.1.0
Please list the version of the relevant packages or applications in which the bug exists.

Steps to reproduce

Configure NServicebus with settings like this

.UseNServiceBus(ServiceBusQueueName, serviceBusNameSpaceFQDN, configuration =>
                {
                    var endpointConfiguration = configuration.AdvancedConfiguration;
                    
                    var credential = new DefaultAzureCredential();
                    var transportWithTokenCredential = new AzureServiceBusTransport(serviceBusNameSpaceFQDN, credential);
                    endpointConfiguration.UseTransport(transportWithTokenCredential);
                })

Relevant log output

The value '' is not a well-formed Service Bus fully qualified namespace. (Parameter 'fullyQualifiedNamespace`. And the FullyQualifiedNamespace value that we passed in the Startup is inside the ConnectionString property

Additional Information

Workarounds

Possible solutions

Additional information

@sanfordn sanfordn added the bug Something isn't working label Aug 24, 2023
@sanfordn
Copy link
Author

Hello, any update on this?

@boblangley boblangley transferred this issue from Particular/NServiceBus.Transport.AzureServiceBus Aug 30, 2023
@DavidBoike
Copy link
Member

Hey @sanfordn,

When using Azure Functions, I don't believe you get to directly instantiate the transport yourself due to how the triggers work. Note the known constraints and limitations section of the docs, how it says calling AdvancedConfiguration.UseTransport() is not supported…as the AdvancedConfiguration is an EndpointConfiguration I would assume that applies inside the .UseNServiceBus(…) method as well.

Is it possible to do what you're trying to do using the Transport property as the docs suggest?

@sanfordn
Copy link
Author

sanfordn commented Sep 1, 2023

Previously in NServiceBus.AzureFunctions.Worker.ServiceBus v4.0.0-rc.2, we were able to do this:
(where configuration is the ServiceBusTriggeredEndpointConfiguration from within UseNServiceBus())

configuration.Transport.TokenCredential = new DefaultAzureCredential();

But it doesn't look like anything like that is available anymore.

image

@DavidBoike
Copy link
Member

@sanfordn I've done a bit of digging and it just appears as though this package isn't set up to support managed identity yet.

There's already an issue #368 raised to support that as a feature.

Given that the known constraints of calling UseTransport() are not supported this isn't really a bug, it's a currently unsupported feature.

I would encourage you to follow #368 for udpates. We regularly do enhancements on our Azure-related packages so I'll suggest that as a for the next iteration.

@sanfordn
Copy link
Author

sanfordn commented Sep 6, 2023

Thanks for taking a look, I'll keep my eye on it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants