0

我正在尝试使用 Azure CLI 命令为我的 Azure EventGrid 主题创建订阅,如下所示 -

az eventgrid topic event-subscription create -g myresname --topic-name mytopicname --name mysubscriptionname --endpoint https://xyz.azurewebsites.net/api/mywebhookdetails

我在 Azure CLI 的 BASH shell 中收到此错误

az eventgrid topic: error: argument _subcommand: invalid choice: event-subscription

是什么原因以及如何解决这个问题?

4

2 回答 2

1

上个月有一个 CLI 更新,在此语法中引入了一些更改。请使用以下命令(唯一的区别是您不需要在 eventgrid 之后指定“主题”):

az eventgrid event-subscription create -g myresname --topic-name mytopicname --name mysubscriptionname --endpoint https://xyz.azurewebsites.net/api/mywebhookdetails

于 2018-02-07T06:06:04.317 回答
1

这是因为您使用的命令az eventgrid topic event-subscription create不适用于最新版本的 Azure CLI。

可以在 Azure CLI 中使用此命令:

az eventgrid event-subscription create --endpoint
                                       --name
                                       [--endpoint-type {eventhub, webhook}]
                                       [--included-event-types]
                                       [--labels]
                                       [--resource-group]
                                       [--resource-id]
                                       [--subject-begins-with]
                                       [--subject-case-sensitive {false, true}]
                                       [--subject-ends-with]
                                       [--topic-name]

例子:

az eventgrid event-subscription create -g myresname --topic-name mytopicname --name mysubscriptionname --endpoint https://xyz.azurewebsites.net/api/mywebhookdetails

您可以在本文档中查看更多详细信息。

于 2018-02-07T06:06:19.913 回答