azure - 通过 HTTP 使用 ServiceBusTrigger 调用 Azure 函数会抛出 InvalidOperationException

标签 azure azure-functions azureservicebus

在我们的部署环境中,我们将有一个通过 ServiceBus 触发的 Azure Function,这非常棒。但对于本地测试,我希望能够利用 following article 中的以下建议:

For all kinds of functions other than HTTP triggers and webhooks, you can test your functions locally by calling an administration endpoint. Calling this endpoint with an HTTP POST request on the local server triggers the function. You can optionally pass test data to the execution in the body of the POST request. This functionality is similar to the Test tab in the Azure portal.

但是,当我向 localhost:7071/admin/functions/NameOfMyFunction 发送请求时,Azure 代码中会引发以下异常:

System.InvalidOperationException: 'No authentication handler is configured to authenticate for the scheme: ArmToken'

对于带有 ServiceBusTrigger 的函数,是否需要在此测试 HTTP 帖子上放置一些身份验证 header ?

最佳答案

For functions with ServiceBusTrigger on them, is there some Authentication header that I need to put on this test HTTP post?

很奇怪你收到这个错误。根据我的测试,不需要为其添加身份验证 header 。我用VS 2017测试了一下,在我这边工作正常。

以下是我的详细步骤,您可以引用:

1.创建一个azure函数应用并添加服务总线触发器。

enter image description here

2.用postman测试

post localhost:7071/admin/functions/{functionName}

body

{"input":"Service Bus Message"}

enter image description here

控制台输出: enter image description here

关于azure - 通过 HTTP 使用 ServiceBusTrigger 调用 Azure 函数会抛出 InvalidOperationException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50672496/

相关文章:

c# - 维护多个实例的处理顺序

消耗计划上的 Azure Function 冷启动时间最长可达 30 分钟

Azure定时器触发器: Cron expression for every hour on the hour

azure - 使用 Azure 服务总线向客户端发送消息 - 主题

azure - 通过 Microsoft Graph API 注册应用程序无法在 Azure 中的企业应用程序下显示它们

azure - 如何使用 Azure Functions 检查授权

azureservicebus - Azure 服务总线的主题/子中批量操作 (enableBatchedOperations) 的目的?

azure - B2C token 生命周期不起作用,新的访问 token 无法通过 APIM

azure - 如何查看服务主体有权访问的 Azure 订阅列表?

azure - 将许可证分配给 guest 用户