You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Get access keys for Event Grid resources (topics or domains)
11
-
Access keys are used to authenticate an application publishing events to Azure Event Grid resources (topics and domains). We recommend regenerating your keys regularly and storing them securely. You are provided with two access keys so that you can maintain connections using one key while regenerating the other.
11
+
Access keys are used to authenticate an application publishing events to Azure Event Grid resources (topics and domains). We recommend regenerating your keys regularly and storing them securely. You're provided with two access keys so that you can maintain connections using one key while regenerating the other.
12
12
13
13
This article describes how to get access keys for an Event Grid resource (topic or domain) using Azure portal, PowerShell, or CLI.
14
14
15
+
> [!IMPORTANT]
16
+
> From August 1, 2024 to August 10, 2024, Azure Event Grid will rollout a security improvement extending the Shared Access Signature (SAS) key length from 44 to 84 characters. This change is being made to strengthen the security of your data in Event Grid resources. The change doesn't impact any application or service that currently publishes events to Event Grid with the old SAS key but it may impact only if you regenerate the SAS key of your Event Grid topics, domains, namespaces, and partner topics, after the update.
17
+
>
18
+
> We recommend that you regenerate your SAS key on or after August 11, 2024. After regenerating the key, update any event publishing applications or services that use the old key to use the enhanced SAS key.
19
+
15
20
## Azure portal
16
21
In the Azure portal, switch to **Access keys** tab of the **Event Grid Topic** or **Event Grid Domain** page for your topic or domain.
17
22
@@ -31,13 +36,13 @@ Get-AzEventGridDomainKey -ResourceGroup <RESOURCE GROUP NAME> -Name <DOMAIN NAME
31
36
```
32
37
33
38
## Azure CLI
34
-
Use the [az eventgrid topic key list](/cli/azure/eventgrid/topic/key#az-eventgrid-topic-key-list) to get access keys for topics.
39
+
Use the [`az eventgrid topic key list`](/cli/azure/eventgrid/topic/key#az-eventgrid-topic-key-list) to get access keys for topics.
35
40
36
41
```azurecli-interactive
37
42
az eventgrid topic key list --resource-group <RESOURCE GROUP NAME> --name <TOPIC NAME>
38
43
```
39
44
40
-
Use [az eventgrid domain key list](/cli/azure/eventgrid/domain/key#az-eventgrid-domain-key-list) to get access keys for domains.
45
+
Use [`az eventgrid domain key list`](/cli/azure/eventgrid/domain/key#az-eventgrid-domain-key-list) to get access keys for domains.
41
46
42
47
```azurecli-interactive
43
48
az eventgrid domain key list --resource-group <RESOURCE GROUP NAME> --name <DOMAIN NAME>
Copy file name to clipboardExpand all lines: articles/event-grid/post-to-custom-topic.md
+84-6Lines changed: 84 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,9 @@
1
1
---
2
2
title: Post event to custom Azure Event Grid topic
3
3
description: This article describes how to post an event to a custom topic. It shows the format of the post and event data.
4
-
ms.topic: conceptual
5
-
ms.date: 01/18/2024
4
+
ms.topic: concept-article
5
+
ms.date: 06/18/2024
6
+
#customer intent: As a developer, I want to know how to publish events to an Azure Event Grid custom topic
6
7
---
7
8
8
9
# Publish events to Azure Event Grid custom topics using access keys
@@ -17,30 +18,48 @@ This article describes how to post an event to a custom topic using an access ke
17
18
18
19
When sending the HTTP POST to a custom topic, use the URI format: `https://<topic-endpoint>?api-version=2018-01-01`. For example, a valid URI is: `https://exampletopic.westus2-1.eventgrid.azure.net/api/events?api-version=2018-01-01`. To get the endpoint for a custom topic using Azure CLI, use:
19
20
21
+
# [Azure portal](#tab/azure-portal)
22
+
You can find the topic's endpoint on the **Overview** tab of the **Event Grid Topic** page in the Azure portal.
23
+
24
+
:::image type="content" source="./media/post-to-custom-topic/topic-endpoint.png" alt-text="Screenshot that shows the Event Grid topic page on the Azure portal with the topic endpoint highlighted." lightbox="./media/post-to-custom-topic/topic-endpoint.png":::
25
+
26
+
# [Azure CLI](#tab/azure-cli)
27
+
20
28
```azurecli-interactive
21
29
az eventgrid topic show --name <topic-name> -g <topic-resource-group> --query "endpoint"
22
30
```
23
31
24
-
To get the endpoint for a custom topic using Azure PowerShell, use:
In the request, include a header value named `aeg-sas-key` that contains a key for authentication. For example, a valid header value is `aeg-sas-key: xxxxxxxxxxxxxxxxxxxxxxx`. To get the key for a custom topic using Azure CLI, use:
33
43
44
+
# [Azure portal](#tab/azure-portal)
45
+
To get the access key for the custom topic, select **Access keys** tab on the **Event Grid Topic** page in the Azure portal.
46
+
47
+
:::image type="content" source="./media/post-to-custom-topic/custom-topic-access-keys.png" alt-text="Screenshot that shows the Access Keys tab of the Event Grid topic page on the Azure portal." lightbox="./media/post-to-custom-topic/custom-topic-access-keys.png":::
48
+
49
+
# [Azure CLI](#tab/azure-cli)
50
+
34
51
```azurecli
35
52
az eventgrid topic key list --name <topic-name> -g <topic-resource-group> --query "key1"
36
53
```
37
54
38
-
To get the key for a custom topic using PowerShell, use:
For custom topics, the top-level data contains the same fields as standard resource-defined events. One of those properties is a `data` property that contains properties unique to the custom topic. As an event publisher, you determine properties for that data object. Here's the schema:
@@ -60,7 +79,7 @@ For custom topics, the top-level data contains the same fields as standard resou
60
79
]
61
80
```
62
81
63
-
For a description of these properties, see [Azure Event Grid event schema](event-schema.md). When posting events to an Event Grid topic, the array can have a total size of up to 1 MB. The maximum allowed size for an event is also 1 MB. Events over 64 KB are charged in 64-KB increments. When receiving events in a batch, the maximum allowed number of events is 5,000 per batch.
82
+
For a description of these properties, see [Azure Event Grid event schema](event-schema.md). When a client sends events to an Event Grid topic, the array can have a total size of up to 1 MB. The maximum allowed size for an event is also 1 MB. Events over 64 KB are charged in 64-KB increments. When a client receives events in a batch, the maximum allowed number of events is 5,000 per batch.
64
83
65
84
For example, a valid event data schema is:
66
85
@@ -78,6 +97,65 @@ For example, a valid event data schema is:
78
97
}]
79
98
```
80
99
100
+
## Send the sample event
101
+
This section shows how to send a sample event to the custom topic.
102
+
103
+
# [Azure portal](#tab/azure-portal)
104
+
105
+
1. In the [Azure portal](https://portal.azure.com), launch Cloud Shell.
106
+
1. In the Cloud Shell, run the commands from the Azure PowerShell or Azure CLI in the **Bash** or **PowerShell** session.
107
+
108
+
:::image type="content" source="./media/post-to-custom-topic/cloud-shell.png" alt-text="Screenshot that shows the Cloud Shell in the Azure portal." lightbox="./media/post-to-custom-topic/cloud-shell.png":::
109
+
110
+
111
+
# [Azure CLI](#tab/azure-cli)
112
+
113
+
```azurecli
114
+
endpoint=$(az eventgrid topic show --name <topic name> -g <resource group name> --query "endpoint" --output tsv)
115
+
116
+
key=$(az eventgrid topic key list --name <topic name> -g <resource group name> --query "key1" --output tsv)
0 commit comments