我有一个由事件网格触发器执行的 Azure 函数。该功能已调试并按设计运行。我能够使用 Azure 门户中的 UI 成功创建对事件网格主题的订阅(单击Add Event Grid subscription
并完成屏幕上的表单)。
问题是尝试使用 CLI(以管理员身份登录的 Cloud Shell)创建订阅时,我无法正确获取端点格式。我使用的基本模板是
az eventgrid event-subscription create --resource-group $resourceGroup
--topic-name $topicName
--included-event-types $includedEventTypes
--name $eventSubscriptionName
--endpoint https://XXX.azurewebsites.net/admin/extensions/EventGridExtensionConfig?functionName=FunctionName&code=ABC123
我尝试从 UI 复制自动填充的端点,包括其代码参数。它可以在 UI 中使用,但不能在 CLI 中使用。当我使用门户中提供的端点和代码运行上述脚本时,我得到以下信息
The term 'code=<XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX> is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
如果我省略代码,我会收到一条消息,指出订阅失败,因为它无法验证端点。
如果我尝试以通常用于函数端点的形式使用端点,https://XXX.azurewebsites.net/FunctionName
我也会收到有关验证的投诉。
从 Cloud Shell 中的 CLI 创建订阅时,端点的正确格式是什么?我是否包含代码参数?我在哪里可以获得正确的代码?
使用:
Microsoft.NET.Sdk.Functions 1.0.19
Microsoft.Azure.EventGrid 1.4.0
Microsoft.Azure.WebJobs.Extensions.EventGrid 1.0.0