I have an event grid domain topic subscription. It has advanced filters set. I am using a powershell to get that event subscription and read the advanced filters, but I get no advanced filter properties at all. I can query the subject filter starts with and ends with properties, but I cannot get my advanced filter values. I used Get-AzEventGridDomainTopicEventSubscription to get event subscription object. Check this screen shot:
has anyone come acrosss this? how can i query the advanced filters property?
Get-AzEventGridDomainTopicEventSubscription
-DomainName <String>
-ResourceGroupName <String>
[-SubscriptionId <String[]>]
-TopicName <String>
[-Filter <String>]
[-Top <Int32>]
[-DefaultProfile <PSObject>]
[-PassThru]
[<CommonParameters>]
I have an event grid domain topic subscription. It has advanced filters set. I am using a powershell to get that event subscription and read the advanced filters, but I get no advanced filter properties at all. I can query the subject filter starts with and ends with properties, but I cannot get my advanced filter values. I used Get-AzEventGridDomainTopicEventSubscription to get event subscription object. Check this screen shot:
has anyone come acrosss this? how can i query the advanced filters property?
Get-AzEventGridDomainTopicEventSubscription
-DomainName <String>
-ResourceGroupName <String>
[-SubscriptionId <String[]>]
-TopicName <String>
[-Filter <String>]
[-Top <Int32>]
[-DefaultProfile <PSObject>]
[-PassThru]
[<CommonParameters>]
Share
edited Mar 10 at 12:10
Sampath
3,9192 gold badges6 silver badges24 bronze badges
Recognized by Microsoft Azure Collective
asked Mar 7 at 22:46
Azure DevAzure Dev
1073 silver badges14 bronze badges
2
- 1 az eventgrid system-topic event-subscription list \ --system-topic-name ravi \ -g sampathp \ --query "[].filter.advancedFilters" – Sampath Commented Mar 10 at 13:48
- Thanks @Sampath. this query does work. – Azure Dev Commented Mar 10 at 14:33
1 Answer
Reset to default 1When using Get-AzEventGridDomainTopicEventSubscription
, the output does not include an AdvancedFilters property. However, to list Event Grid system topic event subscriptions in a given resource group, you can use the following Azure CLI command:
az eventgrid system-topic event-subscription list \
--system-topic-name ravi \
-g sampathp
To retrieve and display only the advancedFilters
properties from the JSON output of the az eventgrid system-topic event-subscription list
command, use the --query
parameter in Azure CLI:
az eventgrid system-topic event-subscription list \
--system-topic-name ravi \
-g sampathp \
--query "[].filter.advancedFilters"
with custom events Refer to this MSDOC for guidance on handling custom events with Event Grid and Azure CLI.
To check which subscriptions exist for a specific Event Grid custom topic, use the following command:
az eventgrid event-subscription list --source-resource-id /subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.EventGrid/topics/<topic-name> --output table
To retrieve subscription filters in a custom Event Grid Topic using Azure CLI, you must explicitly query the filter.advancedFilters
property. Use the following commands:
topicresourceid=$(az eventgrid topic show --resource-group sampathp --name $topicname --query "id" --output tsv)
az eventgrid event-subscription list \
--source-resource-id $topicresourceid \
--query "[].{Name:name, AdvancedFilters:filter.advancedFilters}" \
--output json