将Azure Webhook authLevel设置为匿名(Setting an Azure Webhook authLevel to anonymous)

编程入门 行业动态 更新时间:2024-10-26 02:29:30
将Azure Webhook authLevel设置为匿名(Setting an Azure Webhook authLevel to anonymous)

我希望能够在不必指定密钥的情况下调用我的Azure功能。 该文档似乎表明将'authLevel'设置为匿名实现了这一点 :

authLevel:这确定了在请求中需要出现哪些键(如果有)以调用该函数。 请参阅下面的使用键。 值可以是以下之一:

匿名:不需要API密钥。 function:需要特定于功能的API密钥。 如果未提供,则这是默认值。 admin:主密钥是必需的。

我的约束力是:

"bindings": [ { "type": "httpTrigger", "direction": "in", "authLevel": "anonymous", "webHookType": "genericJson", "name": "req" }, { "type": "http", "direction": "out", "name": "res" } ]

然而,当我在没有密钥的情况下向函数发送请求时,我收到错误:

WebHook验证请求必须包含“代码”查询参数。

我在俯瞰什么?

I'd like to be able to call my Azure function without having to specify a key. The documentation seems to indicate that setting the 'authLevel' to anonymous accomplishes this:

authLevel : This determines what keys, if any, need to be present on the request in order to invoke the function. See Working with keys below. The value can be one of the following:

anonymous: No API key is required. function: A function-specific API key is required. This is the default value if none is provided. admin : The master key is required.

My binding is:

"bindings": [ { "type": "httpTrigger", "direction": "in", "authLevel": "anonymous", "webHookType": "genericJson", "name": "req" }, { "type": "http", "direction": "out", "name": "res" } ]

Yet, when I send a request to the function without a key I receive the error:

The WebHook verification request must contain a 'code' query parameter.

What am I overlooking?

最满意答案

Chris, authLevel不适用于WebHooks,因为您选择的WebHook接收器完全处理了身份验证(例如Slack,Generic JSON,Salesforce等),您会注意到UI中禁用了该选项。

我已经打开此问题以使用此信息增强文档。

如果您需要匿名WebHook来获取JSON有效负载,则可以使用HTTP Trigger函数,将authLevel设置为匿名并直接处理请求或绑定到字符串,JObject或POCO。

Chris, authLevel does not apply to WebHooks as the authentication there is completely handled by the WebHook receiver you select (e.g. Slack, Generic JSON, Salesforce, etc.), you'll notice that option is disabled in the UI.

I've opened this issue to enhance the documentation with this information.

If you need an anonymous WebHook to take a JSON payload, the alternative is to use an HTTP Trigger function, set the authLevel to anonymous and either handle the request directly or bind to a string, JObject or a POCO.

更多推荐

本文发布于:2023-07-16 22:51:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1135384.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:设置为   Webhook   Azure   authLevel   anonymous

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!