Skip to content

Commit 275a303

Browse files
authored
Merge pull request #237200 from AbbyMSFT/custom-props
Changes to common schema custom properties
2 parents 9e62e00 + f8d92c3 commit 275a303

File tree

6 files changed

+25
-41
lines changed

6 files changed

+25
-41
lines changed

articles/azure-monitor/alerts/alerts-common-schema.md

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ The common alert schema provides a consistent structure for:
2222
- Azure Automation runbook
2323

2424
> [!NOTE]
25-
> Alerts generated by [VM insights](../vm/vminsights-overview.md) do not support the common schema.
25+
> - Alerts generated by [VM insights](../vm/vminsights-overview.md) do not support the common schema.
26+
>- Smart detection alerts use the common schema by default. You don't have to enable the common schema for smart detection alerts.
2627
2728
## Structure of the common schema
2829

@@ -31,10 +32,8 @@ The common schema includes information about the affected resource and the cause
3132

3233
If you want to route alert instances to specific teams based on criteria such as a resource group, you can use the fields in the **Essentials** section to provide routing logic for all alert types. The teams that receive the alert notification can then use the context fields for their investigation.
3334
- **Alert context**: Fields that vary depending on the type of the alert. The alert context fields describe the cause of the alert. For example, a metric alert would have fields like the metric name and metric value in the alert context. An activity log alert would have information about the event that generated the alert.
34-
- **Custom properties**: You can add more information to the alert payload by adding custom properties if you've configured action groups for a metric alert rule.
35+
- **Custom properties**: Additional information that is not included in the alert payload by default can be included in the alert payload using custom properties. Custom properties are a **Key:Value** pair that can include any information configured in the alert rule.
3536

36-
> [!NOTE]
37-
> Custom properties are currently only supported by metric alerts. For all other alert types, the **custom properties** field is null.
3837
## Sample alert payload
3938

4039
```json
@@ -139,8 +138,6 @@ For sample alerts that use the common schema, see [Sample alert payloads](alerts
139138
|webTestName |If the condition type is `webtest`, the name of the webtest. |
140139
|windowStartTime |The start time of the evaluation window in which the alert fired. |
141140
|windowEndTime |The end time of the evaluation window in which the alert fired. |
142-
|customProperties ||
143-
144141
### Sample metric alert with a static threshold when the monitoringService = `Platform`
145142

146143
```json
@@ -675,21 +672,13 @@ See [Azure Monitor managed service for Prometheus rule groups (preview)](../esse
675672
```
676673
## Custom properties fields
677674

678-
If you've configured action groups for a metric alert rule, you can add more information to the alert payload by adding custom properties.
679-
680-
The custom properties section contains “key: value” objects that are added to webhook notifications.
675+
If the alert rule that generated your alert contains action groups, custom properties can contain additional information about the alert. The custom properties section contains “key: value” objects that are added to webhook notifications.
681676

682677
If custom properties aren't set in the alert rule, the field is null.
683-
684-
> [!NOTE]
685-
> Custom properties are currently only supported by metric alerts. For all other alert types, the **custom properties** field is null.
686678
## Enable the common alert schema
687679

688680
Use action groups in the Azure portal or use the REST API to enable the common alert schema. Schemas are defined at the action level. For example, you must separately enable the schema for an email action and a webhook action.
689681

690-
> [!NOTE]
691-
> Smart detection alerts support the common schema by default. You don't have to enable the common schema for smart detection alerts.
692-
693682
### Enable the common schema in the Azure portal
694683

695684
![Screenshot that shows the common alert schema opt in.](media/alerts-common-schema/portal-opt-in.png)

articles/azure-monitor/alerts/alerts-create-new-alert-rule.md

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,19 @@ Alerts triggered by these alert rules contain a payload that uses the [common al
243243
244244
:::image type="content" source="media/alerts-create-new-alert-rule/alerts-rule-actions-tab.png" alt-text="Screenshot that shows the Actions tab when creating a new alert rule.":::
245245

246+
1. (Optional) In the **Custom properties** section, if you've configured action groups for this alert rule, you can add custom properties in key:value pairs to the alert payload to add more information to the payload. Add the property **Name** and **Value** for the custom property you want included in the payload.
247+
248+
You can also use custom properties to extract and manipulate data from alert payloads that use the common schema. You can use those values in the action group webhook or logic app.
249+
250+
The format for extracting values from the common schema, use a "$", and then the path of the common schema field inside curly brackets. For example: `${data.essentials.monitorCondition}`.
251+
252+
For example, you could use these values in the **custom properties** to utilize data from the payload.
253+
254+
|Custom properties name |Custom properties value |Result |
255+
|---------|---------|---------|
256+
|AdditionalDetails|Evaluation windowStartTime: ${data.alertContext.condition.windowStartTime}. windowEndTime: ${data.alertContext.condition.windowEndTime}|AdditionalDetails": "Evaluation windowStartTime: 2023-04-04T14:39:24.492Z. windowEndTime: 2023-04-04T14:44:24.492Z" |
257+
|Alert ${data.essentials.monitorCondition} reason |“${data.alertContext.condition.allOf[0].metricName} ${data.alertContext.condition.allOf[0].operator}${data.alertContext.condition.allOf[0].threshold} ${data.essentials.monitorCondition}. The value is ${data.alertContext.condition.allOf[0].metricValue}" |Examples of the results could be: <br> - Alert Resolved reason": "Percentage CPU GreaterThan5 Resolved. The value is 3.585 <br>Percentage CPU GreaterThan5 Fired. The value is 10.585 |
258+
246259
1. On the **Details** tab, define the **Project details**.
247260
- Select the **Subscription**.
248261
- Select the **Resource group**.
@@ -267,9 +280,8 @@ Alerts triggered by these alert rules contain a payload that uses the [common al
267280
|---------|---------|
268281
|Enable upon creation| Select for the alert rule to start running as soon as you're done creating it.|
269282
|Automatically resolve alerts (preview) |Select to make the alert stateful. When an alert is stateful, the alert is resolved when the condition is no longer met.<br> If you don't select this checkbox, metric alerts are stateless. Stateless alerts fire each time the condition is met, even if alert already fired.<br> The frequency of notifications for stateless metric alerts differs based on the alert rule's configured frequency:<br>**Alert frequency of less than 5 minutes**: While the condition continues to be met, a notification is sent somewhere between one and six minutes.<br>**Alert frequency of more than 5 minutes**: While the condition continues to be met, a notification is sent between the configured frequency and double the frequency. For example, for an alert rule with a frequency of 15 minutes, a notification is sent somewhere between 15 to 30 minutes.|
270-
1. (Optional) If you've configured action groups for this alert rule, you can add custom properties to the alert payload to add more information to the payload. In the **Custom properties** section, add the property **Name** and **Value** for the custom property you want included in the payload.
271283

272-
:::image type="content" source="media/alerts-create-new-alert-rule/alerts-metric-rule-details-tab.png" alt-text="Screenshot that shows the Details tab when creating a new alert rule.":::
284+
:::image type="content" source="media/alerts-create-new-alert-rule/alerts-metric-rule-details-tab.png" alt-text="Screenshot that shows the Details tab when creating a new alert rule.":::
273285

274286
### [Log alert](#tab/log)
275287

@@ -285,48 +297,31 @@ Alerts triggered by these alert rules contain a payload that uses the [common al
285297
|Mute actions |Select to set a period of time to wait before alert actions are triggered again. If you select this checkbox, the **Mute actions for** field appears to select the amount of time to wait after an alert is fired before triggering actions again.|
286298
|Check workspace linked storage|Select if logs workspace linked storage for alerts is configured. If no linked storage is configured, the rule isn't created.|
287299

288-
1. (Optional) If you've configured action groups for this alert rule, you can add custom properties to the alert payload to add more information to the payload. In the **Custom properties** section, add the property **Name** and **Value** for the custom property you want included in the payload.
289-
290-
> [!NOTE]
291-
> The [common schema](alerts-common-schema.md) overwrites custom configurations. Therefore, you can't use both custom properties and the common schema for log alerts.
292-
293-
:::image type="content" source="media/alerts-create-new-alert-rule/alerts-log-rule-details-tab.png" alt-text="Screenshot that shows the Details tab when creating a new log alert rule.":::
300+
:::image type="content" source="media/alerts-create-new-alert-rule/alerts-log-rule-details-tab.png" alt-text="Screenshot that shows the Details tab when creating a new log alert rule.":::
294301

295302
### [Activity log alert](#tab/activity-log)
296303

297304
1. Enter values for the **Alert rule name** and the **Alert rule description**.
298305
1. Select the **Region**.
299-
1. (Optional) In the **Advanced options** section, select **Enable upon creation** for the alert rule to start running as soon as you're done creating it.
300-
1. (Optional) If you've configured action groups for this alert rule, you can add custom properties to the alert payload to add more information to the payload. In the **Custom properties** section, add the property **Name** and **Value** for the custom property you want included in the payload.
301-
302-
> [!NOTE]
303-
> The [common schema](alerts-common-schema.md) overwrites custom configurations. Therefore, you can't use both custom properties and the common schema for activity log alerts.
306+
1. Select **Enable upon creation** for the alert rule to start running as soon as you're done creating it.
304307

305-
:::image type="content" source="media/alerts-create-new-alert-rule/alerts-activity-log-rule-details-tab.png" alt-text="Screenshot that shows the Actions tab when creating a new activity log alert rule.":::
308+
:::image type="content" source="media/alerts-create-new-alert-rule/alerts-activity-log-rule-details-tab.png" alt-text="Screenshot that shows the Actions tab when creating a new activity log alert rule.":::
306309

307310
### [Resource Health alert](#tab/resource-health)
308311

309312
1. Enter values for the **Alert rule name** and the **Alert rule description**.
310313
1. Select the **Region**.
311-
1. (Optional) In the **Advanced options** section, select **Enable upon creation** for the alert rule to start running as soon as you're done creating it.
312-
1. (Optional) If you've configured action groups for this alert rule, you can add custom properties to the alert payload to add more information to the payload. In the **Custom properties** section, add the property **Name** and **Value** for the custom property you want included in the payload.
314+
1. Select **Enable upon creation** for the alert rule to start running as soon as you're done creating it.
313315

314-
> [!NOTE]
315-
> The [common schema](alerts-common-schema.md) overwrites custom configurations. Therefore, you can't use both custom properties and the common schema for resource health alerts.
316-
317-
:::image type="content" source="media/alerts-create-new-alert-rule/alerts-activity-log-rule-details-tab.png" alt-text="Screenshot that shows the Actions tab when creating a new activity log alert rule.":::
316+
:::image type="content" source="media/alerts-create-new-alert-rule/alerts-activity-log-rule-details-tab.png" alt-text="Screenshot that shows the Actions tab when creating a new activity log alert rule.":::
318317

319318
### [Service Health alert](#tab/service-health)
320319

321320
1. Enter values for the **Alert rule name** and the **Alert rule description**.
322321
1. Select the **Region**.
323-
1. (Optional) In the **Advanced options** section, select **Enable upon creation** for the alert rule to start running as soon as you're done creating it.
324-
1. (Optional) If you've configured action groups for this alert rule, you can add custom properties to the alert payload to add more information to the payload. In the **Custom properties** section, add the property **Name** and **Value** for the custom property you want included in the payload.
325-
326-
> [!NOTE]
327-
> The [common schema](alerts-common-schema.md) overwrites custom configurations. Therefore, you can't use both custom properties and the common schema for service health alerts.
322+
1. Select **Enable upon creation** for the alert rule to start running as soon as you're done creating it.
328323

329-
:::image type="content" source="media/alerts-create-new-alert-rule/alerts-activity-log-rule-details-tab.png" alt-text="Screenshot that shows the Actions tab when creating a new activity log alert rule.":::
324+
:::image type="content" source="media/alerts-create-new-alert-rule/alerts-activity-log-rule-details-tab.png" alt-text="Screenshot that shows the Actions tab when creating a new activity log alert rule.":::
330325

331326
---
332327

-11.9 KB
Loading
-9.05 KB
Loading
-11.4 KB
Loading
4.1 KB
Loading

0 commit comments

Comments
 (0)