Azure Service Bus trigger with connection=SB fully Qualified Name in binding file, is not working

Abhishake Jaiswal 160 Reputation points
2024-01-08T06:46:31.98+00:00

I am trying to implement to a Service Bus Queue Trigger in nodejs.

my binding file looks similar to below (just values of queue name and connection are updated to function app properties as in attached image)

{
"bindings": [
    {
    "queueName": "testqueue",
    "connection": "MyServiceBusConnection",
    "name": "mySBQItem",
    "type": "serviceBusTrigger",
    "direction": "in"
    }
],
"disabled": false
}

i have 2 doubts

  1. If i put connection property (MyServiceBusConnection) as service bus connection string, it works fine. But if i put connection string as fully qualified name space, the trigger is not consuming messages from queue.

"connection": "SBConnection__fullyQualifiedNamespace"

I have given all required permissions to function to consume messages from queue. (Azure Service Bus Data Receiver, Azure Service Bus Data Owner)

I went through the documentation which says queue triggers work with managed identities and did steps as mentioned in below link.

https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus-trigger?tabs=python-v2%2Cisolated-process%2Cnodejs-v3%2Cextensionv5&pivots=programming-language-javascript#connections

  1. i tried to pass the queue name from function app properties in function.json
    "queueName" : "%SB_MainQueue%"
    but its not working. I need to keep Env specific Queue Names. Please advise

Both properties are set in function app configurations as shown in screenshot.

Any feedback is highly appreciated.

Azure Service Bus
Azure Service Bus
An Azure service that provides cloud messaging as a service and hybrid integration.
700 questions
{count} votes

Accepted answer
  1. MuthuKumaranMurugaachari-MSFT 22,441 Reputation points Moderator
    2024-01-16T14:34:26.45+00:00

    Abhishake Jaiswal Glad to hear that you resolved the issue and thanks for sharing it with the community which will greatly help others with similar issues. As per Microsoft Q&A community policy: "The question author cannot accept their own answer. They can only accept answers by others", I'll repost your solution in case you'd like to "Accept" the answer. Resolution: Abhishake Jaiswal resolved the issue after changing binding configuration like below:

    {
      "bindings": [
        {
          "name": "mySbMsg",
          "type": "serviceBusTrigger",
          "direction": "in",
          "queueName": "%SB_MainQueue%",
          "connection": "serviceBus",
          "autoComplete": true
        }
      ],
      "disabled": false
    }
    

    I will pass feedback to our doc team to add a description note regarding this. Let us know if you have any other questions.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.