Open loGit123 opened 1 week ago
Thank you for your feedback. Tagging and routing to the team member best able to assist.
@loGit123 : Thanks for reaching out and we regret that you're experiencing difficulties. The error message indicates that Functions believes that you're using a connection string rather than an identity-based connection. Unfortunately, there's not enough context available here to offer additional thoughts.
Please be aware that the version of the extensions package that you're using is ~3 years old. Please update to the latest packages and confirm that you're able to reproduce.
If so, please share a code snippet demonstrating your function with its trigger attribute, the relevant section of your host.json, and the relevant section of your configuration settings - with any sensitive information redacted.
Hi @loGit123. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.
Can you please point me to the latest stable version to use for this ? This tutorail I followed - https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-managed-service-identity
The Microsoft.Azure.WebJobs.Extensions.ServiceBus package is currently at v5.16.4. The Azure.Messaging.ServiceBus package is currently at v7.18.1. The versions that you've detailed using are 2-3 years old.
Hi @loGit123. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.
I have changed the version to 5.16.4 and 7.18.1 but still at listener I am getting this error
The listener for function 'ProcessSubscriptions' was unable to start. The connection string used for an Service Bus client must specify the Service Bus namespace host and either a Shared Access Key (both the name and value) OR a Shared Access Signature to be valid. (Parameter 'connectionString')
''Microsoft.Azure.WebJobs.Host.Listeners.FunctionListenerException:
System.ArgumentException:
at Azure.Messaging.ServiceBus.ServiceBusConnection.ValidateConnectionStringProperties (Azure.Messaging.ServiceBus, Version=7.18.1.0, Culture=neutral, PublicKeyToken=92742159e12e44c8)
at Azure.Messaging.ServiceBus.ServiceBusConnection..ctor (Azure.Messaging.ServiceBus, Version=7.18.1.0, Culture=neutral, PublicKeyToken=92742159e12e44c8)
at Azure.Messaging.ServiceBus.ServiceBusClient..ctor (Azure.Messaging.ServiceBus, Version=7.18.1.0, Culture=neutral, PublicKeyToken=92742159e12e44c8)
at Microsoft.Azure.WebJobs.ServiceBus.MessagingProvider+<>cDisplayClass19_0.2.GetOrAdd (System.Collections.Concurrent, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a) at System.Lazy
1.ViaFactory (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Lazy1.ExecutionAndPublication (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Lazy
1.CreateValue (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Microsoft.Azure.WebJobs.ServiceBus.Listeners.ServiceBusListener+<>cDisplayClass36_0.<.ctor>b1.ViaFactory (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Lazy
1.ExecutionAndPublication (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Lazy`1.CreateValue (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Microsoft.Azure.WebJobs.ServiceBus.Listeners.ServiceBusListener+
in arm template, I have added servicebusconnection__fullyQualifiedNamespace. and added roleAssignments for Data Owner and Receiver, Example is like below ....
and for the listener below is the code...
this.QueueClient = client ?? new ServiceBusClient("testservicebus.servicebus.windows.net", new DefaultAzureCredential()).CreateSender(QueueNAme);
Is there anything else has to added to resolve this error?
@loGit123 : Please share your Function signature with the trigger attribute and your config. The listener is part of the trigger infrastructure and has nothing to do with the snippet below. That snippet is creating a sender. That said, you are also leaking the ServiceBusClient which you need to ensure gets disposed or you'll end up orphaning the connection.
Hi @loGit123. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.
public async Task Run( [ServiceBusTrigger(ServiceBusSubscriptionQueue.SUBSCRIPTIONQUEUE, Connection = "ServiceBusConnection")] Subscription subscription, ILogger logger)
Config
appsetting - json(concat('{\"name\":\"ServiceBusConnection__fullyQualifiedNamespace\",\"value\":\"Endpoint=sb://', variables('servicebus_name'), '.servicebus.windows.net\"}'))),
Sometimes this error also I am getting - The listener for function 'ProcessGroups' listener was unable to start. The connection string could not be parsed; either it was malformed or contains no well-known tokens.
A fully qualified namespace name should be something like: your-namespace.servicebus.windows.net
. The value that you're setting is not a valid namespace and is interpreted as a connection string. It is also not a valid connection string, as it's missing the shared key or SAS, so it fails validation. (see: docs).
A couple of other notes:
The config is just a JSON file; I've never seen an active statement like that the app.config consumed by the runtime, and I wouldn't think that it works. I'm assuming that you're showing an interim transform rather than the final config (ARM template, maybe?) But I thought it worth mentioning, just in case.
I would strongly recommend against assuming the suffix of your namespace and forming by hand. There's no guarantee that it will not change in the future and is not valid in all Azure clouds.
Hi @loGit123. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.
/unresolve BUT i AM USING MANAGED IDENITY then why sas is required? and how it is not a valid namespace, I didnt get your point?
this app config is array and the converted to a string thats why it is concatenated like this
/unresolve BUT i AM USING MANAGED IDENITY then why sas is required?
It's not. You're malforming the fully qualified namespace name, as discussed.
and how it is not a valid namespace
Because a valid fully qualified namespace does not have Endpoint=
in it. Remove all but the URI. Please see linked docs for examples and details.
Hi @loGit123. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.
/unresolve BUT i AM USING MANAGED IDENITY then why sas is required?
It's not. You're malforming the fully qualified namespace name, as discussed.
and how it is not a valid namespace
Because a valid fully qualified namespace does not have
Endpoint=
in it. Remove all but the URI. Please see linked docs for examples and details.
Actually I have tried that too, removing the Endpoint= and sb:// but still I got the same issue I am getting. I am not sure what else I am missing.
So long as you're using the raw form, then things should be well. At this point, I think it would be helpful if you shared a small, stand-alone app that reproduces your issue. There's a lot of this discussion that are environmental, and I'm not sure that all of the relevant context is clear.
Hi @loGit123. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.
Library name and version
Microsoft.Azure.WebJobs.Extensions.ServiceBus - 5.2.0 ,Azure.Messaging.ServiceBus - 7.8.0
Query/Question
I am trying to Use ServiceBus Trigeer with Managed Identity but it not able to run as it is giving below error The listener for function 'ProcessSubscriptions' was unable to start. The connection string used for an Service Bus client must specify the Service Bus namespace host and either a Shared Access Key (both the name and value) OR a Shared Access Signature to be valid. (Parameter 'connectionString')
My template.json appsetting - json(concat('{\"name\":\"ServiceBusConnection__fullyQualifiedNamespace\",\"value\":\"Endpoint=sb://', variables('servicebus_name'), '.servicebus.windows.net\"}'))),
Environment
dotnet - 6.0