You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Az PowerShell 12.x中Get-AzEventGridSubscription报错,如何正确列出订阅?

Az PowerShell 12.x 中获取Event Grid订阅的问题及解决方法

问题描述

在Az PowerShell 12.x中执行以下命令:

Get-AzEventGridSubscription -ResourceGroup $ResourceGroup -TopicName $EventGridTopic

出现报错:

cmdlet Get-AzEventGridSubscription at command pipeline position 1
Supply values for the following parameters:
DomainName: 
Get-AzEventGridSubscription: Cannot bind argument to parameter 'DomainName' because it is an empty string.

该命令在Az PowerShell 11.x中可正常运行,且Azure门户显示No event grid domains to display,无法提供有效的DomainName参数值,同时在官方文档、发布说明等资料中未找到相关迁移指引。

解决方法

Az PowerShell 12.x对Get-AzEventGridSubscription的参数集做了调整,针对不同类型的Event Grid资源需要明确指定对应参数:

  • 若要查询指定Event Grid主题的订阅,需明确使用-ResourceGroupName(而非缩写-ResourceGroup)搭配-TopicName,避免触发Domain相关参数校验,命令如下:
    Get-AzEventGridSubscription -ResourceGroupName $ResourceGroup -TopicName $EventGridTopic
    
  • 若要列出当前订阅下所有Event Grid订阅(包含主题、系统主题等各类资源的订阅),可直接执行无资源限定的命令:
    Get-AzEventGridSubscription
    
  • 若要按资源组筛选所有Event Grid订阅,使用:
    Get-AzEventGridSubscription -ResourceGroupName $ResourceGroup
    

内容的提问来源于stack exchange,提问作者alik

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 03:45:59