@@ -4,7 +4,7 @@ description: This article describes how to use Azure API Management as an Event
4
4
ms.topic : conceptual
5
5
author : spelluru
6
6
ms.author : spelluru
7
- ms.date : 06/15/2022
7
+ ms.date : 05/01/2025
8
8
---
9
9
10
10
# Azure API Management as an Event Grid source
@@ -26,23 +26,29 @@ API Management emits the following event types:
26
26
| Microsoft.ApiManagement.ProductCreated | Raised when a product is created. |
27
27
| Microsoft.ApiManagement.ProductUpdated | Raised when a product is updated. |
28
28
| Microsoft.ApiManagement.ProductDeleted | Raised when a product is deleted. |
29
- | Microsoft.ApiManagement.ReleaseCreated | Raised when an API release is created. |
30
- | Microsoft.ApiManagement.ReleaseUpdated | Raised when an API release is updated. |
31
- | Microsoft.ApiManagement.ReleaseDeleted | Raised when an API release is deleted. |
29
+ | Microsoft.ApiManagement.APIReleaseCreated | Raised when an API release is created. |
30
+ | Microsoft.ApiManagement.APIReleaseUpdated | Raised when an API release is updated. |
31
+ | Microsoft.ApiManagement.APIReleaseDeleted | Raised when an API release is deleted. |
32
32
| Microsoft.ApiManagement.SubscriptionCreated | Raised when a subscription is created. |
33
33
| Microsoft.ApiManagement.SubscriptionUpdated | Raised when a subscription is updated. |
34
34
| Microsoft.ApiManagement.SubscriptionDeleted | Raised when a subscription is deleted. |
35
35
| Microsoft.ApiManagement.GatewayCreated | Raised when a self-hosted gateway is created. |
36
36
| Microsoft.ApiManagement.GatewayDeleted | Raised when a self-hosted gateway is updated. |
37
37
| Microsoft.ApiManagement.GatewayUpdated | Raised when a self-hosted gateway is deleted. |
38
- | Microsoft.ApiManagement.GatewayAPIAdded | Raised when an API was removed from a self-hosted gateway. |
39
- | Microsoft.ApiManagement.GatewayAPIRemoved | Raised when an API was removed from a self-hosted gateway. |
40
- | Microsoft.ApiManagement.GatewayCertificateAuthorityCreated | Raised when a certificate authority was updated for a self-hosted. |
41
- | Microsoft.ApiManagement.GatewayCertificateAuthorityDeleted | Raised when a certificate authority was deleted for a self-hosted. |
42
- | Microsoft.ApiManagement.GatewayCertificateAuthorityUpdated | Raised when a certificate authority was updated for a self-hosted. |
43
- | Microsoft.ApiManagement.GatewayHostnameConfigurationCreated | Raised when a hostname configuration was created for a self-hosted. |
44
- | Microsoft.ApiManagement.GatewayHostnameConfigurationDeleted | Raised when a hostname configuration was deleted for a self-hosted. |
45
- | Microsoft.ApiManagement.GatewayHostnameConfigurationUpdated | Raised when a hostname configuration was updated for a self-hosted. |
38
+ | Microsoft.ApiManagement.GatewayAPIAdded | Raised when an API is removed from a self-hosted gateway. |
39
+ | Microsoft.ApiManagement.GatewayAPIRemoved | Raised when an API is removed from a self-hosted gateway. |
40
+ | Microsoft.ApiManagement.GatewayCertificateAuthorityCreated | Raised when a certificate authority is updated for a self-hosted gateway. |
41
+ | Microsoft.ApiManagement.GatewayCertificateAuthorityDeleted | Raised when a certificate authority is deleted for a self-hosted gateway. |
42
+ | Microsoft.ApiManagement.GatewayCertificateAuthorityUpdated | Raised when a certificate authority is updated for a self-hosted gateway. |
43
+ | Microsoft.ApiManagement.GatewayHostnameConfigurationCreated | Raised when a hostname configuration is created for a self-hosted gateway. |
44
+ | Microsoft.ApiManagement.GatewayHostnameConfigurationDeleted | Raised when a hostname configuration is deleted for a self-hosted gateway. |
45
+ | Microsoft.ApiManagement.GatewayHostnameConfigurationUpdated | Raised when a hostname configuration is updated for a self-hosted gateway. |
46
+ | Microsoft.ApiManagement.GatewayAPIAdded| Raised when an API is added to a self-hosted gateway. |
47
+ | Microsoft.ApiManagement.GatewayAPIRemoved| Raised when an API is removed from a self-hosted gateway. |
48
+ | Microsoft.ApiManagement.GatewayTokenNearExpiry | Raised when a self-hosted gateway authentication token is near expiry. |
49
+ | Microsoft.ApiManagement.GatewayTokenExpired | Raised when a self-hosted gateway authentication token is expired. |
50
+ | Microsoft.ApiManagement.CircuitBreaker.Opened | Raised when a backend circuit breaker is opened. |
51
+ | Microsoft.ApiManagement.CircuitBreaker.Closed | Raised when a backend circuit breaker is closed. |
46
52
47
53
## Example event
48
54
@@ -162,6 +168,113 @@ The following example shows the schema of an API updated event. The schema of ot
162
168
163
169
---
164
170
171
+ # [ Cloud event schema] ( #tab/cloud-event-schema )
172
+
173
+ The following example shows the schema of a circuit breaker opened event event.
174
+
175
+ ``` json
176
+ {
177
+ "source" : " /subscriptions/{subscription-id}/resourceGroups/{your-rg}/providers/Microsoft.ApiManagement/service/{your-APIM-instance}" ,
178
+ "subject" : " /backends/{backend-name}/circuit-breaker/rules/{rule-name}" ,
179
+ "type" : " Microsoft.ApiManagement.CircuitBreaker.Opened" ,
180
+ "time" : " 2025-04-02T00:47:47.8536532Z" ,
181
+ "id" : " 92c502f2-a966-42a7-a428-d3b319844544" ,
182
+ "data" : {
183
+ "backendName" : " {backend-name}" ,
184
+ "circuitBreaker" : {
185
+ "rules" : {
186
+ "{rule-name}" : {
187
+ "tripDuration" : " 00:00:01"
188
+ }
189
+ }
190
+ }
191
+ },
192
+ "specVersion" : " 1.0"
193
+ }
194
+ ```
195
+
196
+
197
+ # [ Event Grid event schema] ( #tab/event-grid-event-schema )
198
+
199
+ The following example shows the schema of a circuit breaker opened event event. The schema of a circuit breaker closed event is similar.
200
+
201
+ ``` json
202
+ {
203
+ "id" : " 92c502f2-a966-42a7-a428-d3b319844544" ,
204
+ "topic" : " /subscriptions/{subscription-id}/resourceGroups/{your-rg}/providers/Microsoft.ApiManagement/service/{your-APIM-instance}" ,
205
+ "subject" : " /backends/{backend-name}/circuit-breaker/rules/{rule-name}" ,
206
+ "data" : {
207
+ "backendName" : " {backend-name}" ,
208
+ "circuitBreaker" : {
209
+ "rules" : {
210
+ "{rule-name}" : {
211
+ "tripDuration" : " 00:00:01"
212
+ }
213
+ }
214
+ }
215
+ },
216
+ "eventType" : " Microsoft.ApiManagement.CircuitBreaker.Opened" ,
217
+ "dataVersion" : " 1" ,
218
+ "metadataVersion" : " 1" ,
219
+ "eventTime" : " 2025-04-02T00:47:48.8269769Z"
220
+ }
221
+ ```
222
+
223
+ ---
224
+
225
+ # [ Cloud event schema] ( #tab/cloud-event-schema )
226
+
227
+ The following example shows the schema of a gateway token expired event.
228
+
229
+ ``` json
230
+ {
231
+ "source" : " /subscriptions/{subscription-id}/resourceGroups/{your-rg}/providers/Microsoft.ApiManagement/service/{your-APIM-instance}" ,
232
+ "subject" : " /gateways/{gateway-name}/{instance-name}" ,
233
+ "type" : " Microsoft.ApiManagement.GatewayTokenExpired" ,
234
+ "time" : " 2025-04-02T00:47:47.8536532Z" ,
235
+ "id" : " 92c502f2-a966-42a7-a428-d3b319844544" ,
236
+ "data" : {
237
+ "gatewayInfo" : {
238
+ "gatewayId" : " {gateway-name}" ,
239
+ "instanceId" : " {instance-name}"
240
+ },
241
+ "tokenInfo" : {
242
+ "expiredAtUtc" : " 2025-02-25T08:56:00.0000000Z"
243
+ }
244
+ },
245
+ "specVersion" : " 1.0"
246
+ }
247
+
248
+ ```
249
+
250
+
251
+ # [ Event Grid event schema] ( #tab/event-grid-event-schema )
252
+
253
+ The following example shows the schema of a gateway token expired event.
254
+
255
+ ``` json
256
+ {
257
+ "id" : " 92c502f2-a966-42a7-a428-d3b319844544" ,
258
+ "topic" : " /subscriptions/{subscription-id}/resourceGroups/{your-rg}/providers/Microsoft.ApiManagement/service/{your-APIM-instance}" ,
259
+ "subject" : " /gateways/{gateway-name}/{instance-name}" ,
260
+ "data" : {
261
+ "gatewayInfo" : {
262
+ "gatewayId" : " {gateway-name}" ,
263
+ "instanceId" : " {instance-name}"
264
+ },
265
+ "tokenInfo" : {
266
+ "edAtUtc" : " 2025-02-25T08:56:00.0000000Z"
267
+ }
268
+ },
269
+ "eventType" : " Microsoft.ApiManagement.GatewayTokenExpired" ,
270
+ "dataVersion" : " 1" ,
271
+ "metadataVersion" : " 1" ,
272
+ "eventTime" : " 2025-04-02T00:47:48.8269769Z"
273
+ }
274
+ ```
275
+
276
+ ---
277
+
165
278
## Event properties
166
279
167
280
@@ -196,12 +309,37 @@ An event has the following top-level data:
196
309
197
310
---
198
311
199
- The data object has the following properties:
312
+
313
+ ### Data object properties
314
+
315
+ The ` data ` object has the following properties for control plane events such as creating, updating, and deleting API Management resources.
316
+
317
+ #### Control plane events
200
318
201
319
| Property | Type | Description |
202
320
| -------- | ---- | ----------- |
203
321
| ` resourceUri ` | string | The fully qualified ID of the resource that the compliance state change is for, including the resource name and resource type. Uses the format, ` /subscriptions/<SubscriptionID>/resourceGroups/<ResourceGroup>/Microsoft.ApiManagement/service/<ServiceName>/<ResourceType>/<ResourceName> ` |
204
322
323
+ #### Circuit breaker events
324
+
325
+ The ` data ` object has the following properties for circuit breaker events.
326
+
327
+
328
+ | Property | Type | Description |
329
+ | -------- | ---- | ----------- |
330
+ | ` backendNme ` | string | The name (ID) of the backend entity in which the circuit breaker is configured. |
331
+ |` circuitBreaker ` | object | The circuit breaker configured in the backend, consisting of a ` rules ` object specifying the rule that tripped the backed. The rule has a ` tripDuration ` property in hh:mm: ss format specifying the duration for which the circuit breaker is tripped.
332
+
333
+ #### Self-hosted gateway authentication token events
334
+
335
+ The ` data ` object has the following properties for self-hosted gateway authentication token events.
336
+
337
+ | Property | Type | Description |
338
+ | -------- | ---- | ----------- |
339
+ | ` gatewayInfo ` | object | The self-hosted gateway information, consisting of the following string properties:<br /><br />* ` gatewayId ` - The fully qualified ID of the gateway resource<br />* ` instanceId ` - Unique instance ID of the deployed gateway |
340
+ | ` tokenInfo ` | object | The token information, consisting of one of the following properties in the provider's UTC time:<br /><br />* ` expiresAtUtc ` - for ` GatewayTokenNearExpiry ` event, or<br />* ` expiredAtUtc ` - for ` GatewayTokenExpired ` event |
341
+
342
+
205
343
## Tutorials and how-tos
206
344
207
345
| Title | Description |
0 commit comments