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

如何通过CLI或PowerShell查看Azure Service Bus主题订阅规则的过滤器?

Absolutely! You don’t need to rely on C# code to inspect Service Bus topic subscription rules and their filters. Both Azure CLI and Azure PowerShell offer simple, direct commands to retrieve this information. Here’s how to do it with each tool:

Using Azure CLI

First, list all rules associated with your target subscription to get their names:

az servicebus topic subscription rule list \
  --resource-group *<your-resource-group-name>* \
  --namespace-name *<your-servicebus-namespace>* \
  --topic-name *<your-topic-name>* \
  --subscription-name *<your-subscription-name>*

This command returns a JSON array with basic metadata for each rule. To pull the full filter details for a specific rule, use the show command:

az servicebus topic subscription rule show \
  --resource-group *<your-resource-group-name>* \
  --namespace-name *<your-servicebus-namespace>* \
  --topic-name *<your-topic-name>* \
  --subscription-name *<your-subscription-name>* \
  --name *<your-rule-name>*

Look for the filter property in the output—it will include the filter type (SQL or Correlation) and the exact expression/configurations you’ve set up.

Using Azure PowerShell

First, ensure you have the Az.ServiceBus module installed (run this if you don’t have it yet):

Install-Module -Name Az.ServiceBus -Force -AllowClobber

Next, list all rules for your subscription to identify the one you want to inspect:

Get-AzServiceBusRule -ResourceGroupName *<your-resource-group-name>* `
  -NamespaceName *<your-servicebus-namespace>* `
  -TopicName *<your-topic-name>* `
  -SubscriptionName *<your-subscription-name>*

To view the filter details for a specific rule, target it directly and select the relevant properties:

Get-AzServiceBusRule -ResourceGroupName *<your-resource-group-name>* `
  -NamespaceName *<your-servicebus-namespace>* `
  -TopicName *<your-topic-name>* `
  -SubscriptionName *<your-subscription-name>* `
  -Name *<your-rule-name>* | Select-Object Name, FilterType, SqlFilter, CorrelationFilter

The SqlFilter or CorrelationFilter properties will display the exact filter logic tied to the rule.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.21 03:34:58