Skip to content

Commit 6808ae6

Browse files
committed
Filter examples are part of ARM templates
1 parent 25b6297 commit 6808ae6

File tree

1 file changed

+64
-1
lines changed

1 file changed

+64
-1
lines changed

articles/event-grid/event-filtering.md

Lines changed: 64 additions & 1 deletion
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,69 @@ 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 teplate, 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 stroage account
20+
- System topic for the storage account
21+
- Event subscription for the system topic. This is the section where you'll see the `filter` subsection.
22+
23+
In the following example, the event subscription filters for `Microsoft.Storage.BlobCreated` and `Microsoft.Storage.BlobDeleted` events.
24+
25+
```json{
26+
"resources": [
27+
{
28+
"type": "Microsoft.Storage/storageAccounts",
29+
"apiVersion": "2021-08-01",
30+
"name": "[parameters('storageAccountName')]",
31+
"location": "[parameters('location')]",
32+
"sku": {
33+
"name": "Standard_LRS"
34+
},
35+
"kind": "StorageV2",
36+
"properties": {
37+
"accessTier": "Hot"
38+
}
39+
},
40+
{
41+
"type": "Microsoft.EventGrid/systemTopics",
42+
"apiVersion": "2021-12-01",
43+
"name": "[parameters('systemTopicName')]",
44+
"location": "[parameters('location')]",
45+
"properties": {
46+
"source": "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]",
47+
"topicType": "Microsoft.Storage.StorageAccounts"
48+
},
49+
"dependsOn": [
50+
"[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]"
51+
]
52+
},
53+
{
54+
"type": "Microsoft.EventGrid/systemTopics/eventSubscriptions",
55+
"apiVersion": "2021-12-01",
56+
"name": "[format('{0}/{1}', parameters('systemTopicName'), parameters('eventSubName'))]",
57+
"properties": {
58+
"destination": {
59+
"properties": {
60+
"endpointUrl": "[parameters('endpoint')]"
61+
},
62+
"endpointType": "WebHook"
63+
},
64+
"filter": {
65+
"includedEventTypes": [
66+
"Microsoft.Storage.BlobCreated",
67+
"Microsoft.Storage.BlobDeleted"
68+
]
69+
}
70+
},
71+
"dependsOn": [
72+
"[resourceId('Microsoft.EventGrid/systemTopics', parameters('systemTopicName'))]"
73+
]
74+
}
75+
]
76+
}
77+
```
78+
1679
## Event type filtering
1780

1881
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.

0 commit comments

Comments
 (0)