Skip to content

Commit 7ebc282

Browse files
Merge pull request #210743 from spelluru/egridfilter0909
Filter examples are part of ARM templates
2 parents 6892b02 + 3ae7975 commit 7ebc282

File tree

1 file changed

+66
-2
lines changed

1 file changed

+66
-2
lines changed

articles/event-grid/event-filtering.md

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Event filtering for Azure Event Grid
33
description: Describes how to filter events when creating an Azure Event Grid subscription.
44
ms.topic: conceptual
5-
ms.date: 06/01/2022
5+
ms.date: 09/09/2022
66
---
77

88
# Understand event filtering for Event Grid subscriptions
@@ -13,6 +13,70 @@ This article describes the different ways to filter which events are sent to you
1313
* Subject begins with or ends with
1414
* Advanced fields and operators
1515

16+
## Azure Resource Manager template
17+
The examples shown in this article are JSON snippets for defining filters in Azure Resource Manager (ARM) templates. For an example of a complete ARM template and deploying an ARM template, see [Quickstart: Route Blob storage events to web endpoint by using an ARM template](blob-event-quickstart-template.md). Here's some more sections around the `filter` section from the example in the quickstart. The ARM template defines the following resources.
18+
19+
- Azure storage account
20+
- System topic for the storage account
21+
- Event subscription for the system topic. You'll see the `filter` subsection in the event subscription section.
22+
23+
In the following example, the event subscription filters for `Microsoft.Storage.BlobCreated` and `Microsoft.Storage.BlobDeleted` events.
24+
25+
```json
26+
{
27+
"resources": [
28+
{
29+
"type": "Microsoft.Storage/storageAccounts",
30+
"apiVersion": "2021-08-01",
31+
"name": "[parameters('storageAccountName')]",
32+
"location": "[parameters('location')]",
33+
"sku": {
34+
"name": "Standard_LRS"
35+
},
36+
"kind": "StorageV2",
37+
"properties": {
38+
"accessTier": "Hot"
39+
}
40+
},
41+
{
42+
"type": "Microsoft.EventGrid/systemTopics",
43+
"apiVersion": "2021-12-01",
44+
"name": "[parameters('systemTopicName')]",
45+
"location": "[parameters('location')]",
46+
"properties": {
47+
"source": "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]",
48+
"topicType": "Microsoft.Storage.StorageAccounts"
49+
},
50+
"dependsOn": [
51+
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]"
52+
]
53+
},
54+
{
55+
"type": "Microsoft.EventGrid/systemTopics/eventSubscriptions",
56+
"apiVersion": "2021-12-01",
57+
"name": "[format('{0}/{1}', parameters('systemTopicName'), parameters('eventSubName'))]",
58+
"properties": {
59+
"destination": {
60+
"properties": {
61+
"endpointUrl": "[parameters('endpoint')]"
62+
},
63+
"endpointType": "WebHook"
64+
},
65+
"filter": {
66+
"includedEventTypes": [
67+
"Microsoft.Storage.BlobCreated",
68+
"Microsoft.Storage.BlobDeleted"
69+
]
70+
}
71+
},
72+
"dependsOn": [
73+
"[resourceId('Microsoft.EventGrid/systemTopics', parameters('systemTopicName'))]"
74+
]
75+
}
76+
]
77+
}
78+
```
79+
1680
## Event type filtering
1781

1882
By default, all [event types](event-schema.md) for the event source are sent to the endpoint. You can decide to send only certain event types to your endpoint. For example, you can get notified of updates to your resources, but not notified for other operations like deletions. In that case, filter by the `Microsoft.Resources.ResourceWriteSuccess` event type. Provide an array with the event types, or specify `All` to get all event types for the event source.
@@ -549,7 +613,7 @@ The IsNotNull operator evaluates to true if the key's value isn't NULL or undefi
549613
```
550614

551615
## OR and AND
552-
If you specify a single filter with multiple values, an **OR** operation is performed, so the value of the key field must be one of these values. Here is an example:
616+
If you specify a single filter with multiple values, an **OR** operation is performed, so the value of the key field must be one of these values. Here's an example:
553617

554618
```json
555619
"advancedFilters": [

0 commit comments

Comments
 (0)