将 Azure Webhook authLevel 设置为匿名
Setting an Azure Webhook authLevel to anonymous
我希望能够在不指定密钥的情况下调用我的 Azure 函数。 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.
我的绑定是:
"bindings": [
{
"type": "httpTrigger",
"direction": "in",
"authLevel": "anonymous",
"webHookType": "genericJson",
"name": "req"
},
{
"type": "http",
"direction": "out",
"name": "res"
}
]
然而,当我在没有密钥的情况下向函数发送请求时,我收到错误消息:
The WebHook verification request must contain a 'code' query parameter.
我忽略了什么?
克里斯,
authLevel
不适用于 WebHooks,因为那里的身份验证完全由您 select 的 WebHook 接收器处理(例如 Slack、Generic JSON、Salesforce 等),您会注意到该选项在 UI.
中被禁用
我已经打开 this issue 以使用此信息增强文档。
如果您需要匿名 WebHook 来获取 JSON 负载,另一种方法是使用 HTTP 触发器函数,将 authLevel
设置为匿名并直接处理请求或绑定到字符串、JObject 或 POCO。
我希望能够在不指定密钥的情况下调用我的 Azure 函数。 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.
我的绑定是:
"bindings": [
{
"type": "httpTrigger",
"direction": "in",
"authLevel": "anonymous",
"webHookType": "genericJson",
"name": "req"
},
{
"type": "http",
"direction": "out",
"name": "res"
}
]
然而,当我在没有密钥的情况下向函数发送请求时,我收到错误消息:
The WebHook verification request must contain a 'code' query parameter.
我忽略了什么?
克里斯,
authLevel
不适用于 WebHooks,因为那里的身份验证完全由您 select 的 WebHook 接收器处理(例如 Slack、Generic JSON、Salesforce 等),您会注意到该选项在 UI.
我已经打开 this issue 以使用此信息增强文档。
如果您需要匿名 WebHook 来获取 JSON 负载,另一种方法是使用 HTTP 触发器函数,将 authLevel
设置为匿名并直接处理请求或绑定到字符串、JObject 或 POCO。