简体   繁体   中英

Python Function App connections using managed identity

Unable to set up connection information for service bus with Python Azure functions for managed identity.

I have the following settings in function.json

{
  "scriptFile": "__init__.py",
  "bindings": [
    {
      "name": "msg",
      "type": "serviceBusTrigger",
      "direction": "in",
      "queueName": "myinputqueue",
      "connection": "MySvcConn"
    }
  ]
}

and in Application settings in Azure portal i have set

"MySvcConn__fullyQualifiedNamespace":"mysvcns.servicebus.windows.net"

I get the message

"Microsoft.Azure.ServiceBus: Value for the connection string 
parameter name 'mysvcns.servicebus.windows.net' was not found. (Parameter 'connectionString').

Version of Runtime used ~4

host.json configuration

{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    }
  },
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[2.*, 3.0.0)"
  }
}
  • To connect to service bus using a managed Identity we have first add servicebus data receiver role to the access control.

  • Then add the connection setting to application setting under the name ServiceBusConnection__fullyQualifiedNamespace and add the connection value as <Name_of_servicebus>.servicebus.windows.net .

  • The above setting will connect the function app to the service bus using managed identity without the use of connection string.

Refer this documentation

Was able to figure this out, need to set up application settings in function app for the following

ServiceBusConnection__clientID:<managedidenity client id>
ServiceBusConnection__credential:managedidentity
ServiceBusConnection__fullyQualifiedNamespace:<servicebusname>.servicebus.windows.net

"ServiceBusConnection" in the above settings being the connection name in function.json file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM