我正在按照此处列出的步骤进行操作,但对于 python 代码:https://learn.microsoft.com/en-us/azure/azure-functions/functions-identity-based-connections-tutorial-2 https://learn.microsoft.com/en-us/azure/azure-functions/functions-identity-based-connections-tutorial-2
目标是创建一个简单的 (hello world) 函数应用程序,该应用程序由使用基于身份的连接的 Azure 服务总线消息队列触发。当通过连接字符串引用 ASB 时,函数应用程序工作正常,但在尝试通过函数应用程序的托管服务标识进行连接时会出现此错误(使用特定配置模式 __filledQualifiedNamespace)。 MSI 已被授予 ASB 上的角色(Azure 服务总线数据接收器)。
Microsoft.Azure.WebJobs.ServiceBus: Microsoft Azure WebJobs SDK ServiceBus connection string 'ServiceBusConnection__fullyQualifiedNamespace' is missing or empty.
功能码(自动生成)
import logging
import azure.functions as func
def main(msg: func.ServiceBusMessage):
logging.info('Python ServiceBus queue trigger processed message: %s',
msg.get_body().decode('utf-8'))
函数.json(连接值根据ms文档修改)
{
"scriptFile": "__init__.py",
"bindings": [
{
"name": "msg",
"type": "serviceBusTrigger",
"direction": "in",
"queueName": "erpdemoqueue",
"connection": "ServiceBusConnection"
}
]
}
主机.json(根据ms文档修改的版本)
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[3.3.0, 4.0.0)"
}
}