-1

I have an azure function written in python which is listening to an azure service bus. The authentication is done by an azure service bus connection string. I want to change the authentication to a service principal. How can I implement this in my azure function?

Below is my function.json file. I expect that there are other values possible for the "connection" parameter.

  "scriptFile": "__init__.py",
  "bindings": [
    {
      "name": "msg",
      "type": "serviceBusTrigger",
      "direction": "in",
      "queueName": "queue_name",
      "connection": "ASB_CONNECTION_STR"
    }
  ]
}
Jesse Squire
  • 6,107
  • 1
  • 27
  • 30
RDS
  • 69
  • 7
  • Does this answer your question? [How to access Azure Service Bus using Function App identity](https://stackoverflow.com/questions/71142868/how-to-access-azure-service-bus-using-function-app-identity) – Jesse Squire Mar 10 '22 at 13:10

1 Answers1

0

As suggested by User Jesse Squire - Stack Overflow, use this connection parameter in your local.settings.json :

{
"Values": {
"<connection_name>__fullyQualifiedNamespace": "<service_bus_namespace>.servicebus.windows.net"
}
}

Or in the application settings for your function when deployed to Azure:

<connection_name>__fullyQualifiedNamespace=<service_bus_namespace>.servicebus.windows.net 

References: Use identity-based connections with Azure Functions triggers and bindings | Microsoft Docs and Azure WebJobs Service Bus client library for .NET - Azure for .NET Developers | Microsoft Docs

Madhuraj Vadde
  • 1,099
  • 1
  • 5
  • 13