首页 > 解决方案 > Update-AzureRmEventGridSubscription 设置主题前缀/后缀为字符串空

问题描述

我有 PowerShell 脚本来更新 EventGrid 订阅。一种可能的情况是设置订阅主题前缀/后缀来定义值。

Update-AzureRmEventGridSubscription -ResourceGroup $ResourceGroupName -TopicName $EventGridTopicName -EventSubscriptionName $Subscription.name -SubjectEndsWith $Subscription.subjectEndsWith

当 value 不为 null 或为空时,它可以正常工作。但是当它需要设置为 '' 它抛出

 Cannot validate argument on parameter 'SubjectBeginsWith'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again

我应该重新创建订阅吗?

标签: powershellazure-eventgrid

解决方案


这看起来是 Update-AzureRmEventGridSubscription 实现中的一个错误,感谢您报告这个!我在https://github.com/Azure/azure-powershell/issues/6331提交了一个问题来跟踪这个问题。

在 EventGrid PowerShell 模块中解决此问题之前,解决方法是:

1) 删除并重新创建事件订阅,或者

2) 在 Azure CLI 中使用等效命令 (az eventgrid event-subscription update --resource-group your-rg-name --topic-name your-topic-name --name your-event-subscription-name --subject -以。。结束 ””)。


推荐阅读