创建事件网格订阅的正确端点格式是什么

What is a proper endpoint format for creating an Event Grid subscription

我有一个由事件网格触发器执行的 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,我也会收到有关验证的投诉。

从云中的 CLI 创建订阅时端点的正确格式是什么 Shell?我是否包含代码参数?我在哪里可以获得正确的代码?

使用:

Microsoft.NET.Sdk.Functions 1.0.19
Microsoft.Azure.EventGrid 1.4.0
Microsoft.Azure.WebJobs.Extensions.EventGrid 1.0.0

尝试用引号括起您的函数端点,& 似乎是 CLi 语法中的保留符号,因此您的参数 code 是从 url 中删除的。