Skip to content

Commit e8ac0c4

Browse files
authored
Merge pull request #252422 from AbbyMSFT/api-dep
Add article: migrating from the Get Summary API
2 parents 2c61061 + ff2ed2a commit e8ac0c4

File tree

4 files changed

+137
-60
lines changed

4 files changed

+137
-60
lines changed

articles/azure-monitor/alerts/alerts-troubleshoot.md

Lines changed: 2 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ If you have received a notification for an alert (such as an email or an SMS) mo
164164
![Screenshot of multiple action groups in an alert.](media/alerts-troubleshoot/action-repeated-multi-action-groups.png)
165165

166166
## Action or notification has an unexpected content
167-
Action Groups uses two different email providers to ensure email notification delivery. The primary email provider is very resilient and quick but occasionally suffers outages. In this case, the secondary email provider handles email requests. The secondary provider is only a fallback solution. Due to provider differences, an email sent from our secondary provider may have a degraded email experience. The degradation results in slightly different email formatting and content. Since email templates differ in the two systems, maintaining parity across the two systems is not feasible. You can know that you are recieving a degraded experience, if there is a note at the top of your email notification that says:
167+
Action Groups uses two different email providers to ensure email notification delivery. The primary email provider is very resilient and quick but occasionally suffers outages. In this case, the secondary email provider handles email requests. The secondary provider is only a fallback solution. Due to provider differences, an email sent from our secondary provider may have a degraded email experience. The degradation results in slightly different email formatting and content. Since email templates differ in the two systems, maintaining parity across the two systems is not feasible. You can know that you are receiving a degraded experience, if there is a note at the top of your email notification that says:
168168

169-
"This is a degraded email experience. That means the formatting may be off or details could be missing. For more infomration on the degraded email experience, read here."
169+
"This is a degraded email experience. That means the formatting may be off or details could be missing. For more information on the degraded email experience, read here."
170170

171171
If your notification does not contain this note and you have received the alert, but believe some of its fields are missing or incorrect, follow these steps:
172172

@@ -247,58 +247,6 @@ If you received an error while trying to create, update or delete an [alert proc
247247

248248
Check the [alert processing rule documentation](../alerts/alerts-action-rules.md), or the [alert processing rule PowerShell Set-AzActionRule](/powershell/module/az.alertsmanagement/set-azalertprocessingrule) command.
249249

250-
## How to Migrate the Get alert summary API to ARG query
251-
252-
Get alert summary API return the summary of alerts using API, today once we opened the option to use ARG query everywhere (including alerts) you can use ARG query directly and by that to have an option to be more flexible.
253-
If you are using “GetAlertSummary” API, we recommend using ARG query API and list out the benefits
254-
* Ability to add new fields to the query that returns the alert summary.
255-
* Ability to be more flexible in the query that returns the alert summary.
256-
This is an example of how today we use “GetAlertSummary” API:
257-
258-
GET https://management.azure.com/subscriptions/{subId}/providers/Microsoft.AlertsManagement/alertsSummary?groupby=severity,alertState&api-version=2019-03-01
259-
Response: AlertSummary_Sev_Alertstate
260-
261-
Instead of “GetAlertSummary” API you can create a query via ARG, examples for 2 uses of ARG query that can be used instead of “GetAlertSummary” API using different parameters. You can use this as a baseline for your query and build it exactly according to your needs.
262-
* Query to ARG by Severity, AlertState:
263-
Post  https://management.azure.com/providers/Microsoft.ResourceGraph/resources?api-version=2020-04-01-preview
264-
{
265-
query: "alertsmanagementresources
266-
| where type =~ 'microsoft.alertsmanagement/alerts' 
267-
| where todatetime(properties.essentials.startDateTime) >= ago(2h) and todatetime(properties.essentials.startDateTime) < now()
268-
| project Severity = tostring(properties.essentials.severity),
269-
AlertState= tostring(properties.essentials.alertState)
270-
| summarize AlertsCount = count() by Severity, AlertState"
271-
}
272-
* Query to ARG by Severity:
273-
Post  https://management.azure.com/providers/Microsoft.ResourceGraph/resources?api-version=2020-04-01-preview
274-
{
275-
query: "alertsmanagementresources
276-
| where type =~ 'microsoft.alertsmanagement/alerts' 
277-
| where todatetime(properties.essentials.startDateTime) >= ago(2h) and todatetime(properties.essentials.startDateTime) < now()
278-
| project Severity = tostring(properties.essentials.severity)
279-
| summarize AlertsCount = count() by Severity"
280-
}
281-
* Query to ARG by Severity, monitorService, TargetResourceType
282-
Post  https://management.azure.com/providers/Microsoft.ResourceGraph/resources?api-version=2020-04-01-preview
283-
{
284-
query: "alertsmanagementresources
285-
| where type =~ 'microsoft.alertsmanagement/alerts' 
286-
| where todatetime(properties.essentials.startDateTime) >= ago(2h) and todatetime(properties.essentials.startDateTime) < now()
287-
| project Severity = tostring(properties.essentials.severity),
288-
MonitorCondition = tostring(properties.essentials.monitorCondition),
289-
ObjectState = tostring(properties.essentials.alertState),
290-
MonitorService = tostring(properties.essentials.monitorService),
291-
AlertRuleId = tostring(properties.essentials.alertRule),
292-
SignalType = tostring(properties.essentials.signalType),
293-
TargetResource = tostring(properties.essentials.targetResourceName),
294-
TargetResourceType = tostring(properties.essentials.targetResourceName),
295-
id 
296-
| summarize AlertsCount = count() by Severity, MonitorService , TargetResourceType"
297-
}
298-
299-
300-
301-
302250
## Next steps
303251
- If using a log alert, also see [Troubleshooting Log Alerts](./alerts-troubleshoot-log.md).
304252
- Go back to the [Azure portal](https://portal.azure.com) to check if you've solved your issue with guidance above.
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
---
2+
title: Migrate from the Azure Monitor alertsSummary API
3+
description: Find out how to migrate from the Azure Monitor alertsSummary API, which is being deprecated
4+
ms.topic: how-to
5+
ms.date: 09/21/2023
6+
ms.author: abbyweisberg
7+
---
8+
9+
10+
# Migrate from the alertsSummary API to ARG queries
11+
12+
The [alertsSummary API](/rest/api/monitor/alertsmanagement/alerts/get-summary) is being deprecated as of September 30,2026. Instead of the alertsSummary API, you can use Azure Resource Graph queries to get the same information.
13+
14+
Azure Resource Graph queries provide flexibility to query your Azure data and can be used for Azure monitor alerts instead of the alertsSummary API.
15+
16+
Azure Resource Graph queries provide more functionality than the alertsSummary API, including:
17+
* The ability to add new fields to the query that returns the alert summary.
18+
* The ability to be more flexible in the query that returns the alert summary.
19+
20+
## Implementation of the current alertsSummary API:
21+
22+
This is the format for the calling the alertsSummary API:
23+
24+
`GET https://management.azure.com/subscriptions/{subId}/providers/Microsoft.AlertsManagement/alertsSummary?groupby=severity,alertState&api-version=2019-03-01`
25+
26+
Response: AlertSummary_Sev_Alertstate
27+
28+
This is an example of the output from the alertsSummary API:
29+
30+
```json
31+
{
32+
"totalRecords": 2,
33+
"count": 2,
34+
"data": {
35+
"columns": [
36+
{"name": "Severity",
37+
"type": "string"
38+
},
39+
{"name": "AlertState",
40+
"type": "string"
41+
},
42+
{
43+
"name": "AlertsCount",
44+
"type": "integer"
45+
}
46+
],
47+
"rows": [
48+
[
49+
"Sev2",
50+
"New",
51+
2
52+
],
53+
[
54+
"Sev1",
55+
"New",
56+
8
57+
]
58+
]
59+
},
60+
"facets": [],
61+
"resultTruncated": false
62+
}
63+
```
64+
65+
## Use the Azure Resource Graph query
66+
67+
Use these Azure Resource Graph queries instead of the alertsSummary API call to retrieve alert information, or use these queries as a basis for designing your own queries.
68+
69+
- [List Azure Monitor alerts ordered by severity](../../governance/resource-graph/samples/starter.md#list-azure-monitor-alerts-ordered-by-severity)
70+
- [List Azure Monitor alerts ordered by severity and alert state](../../governance/resource-graph/samples/starter.md#list-azure-monitor-alerts-ordered-by-severity-and-alert-state)
71+
- [List Azure Monitor alerts ordered by severity, monitor service, and target resource type](../../governance/resource-graph/samples/starter.md#list-azure-monitor-alerts-ordered-by-severity-monitor-service-and-target-resource-type)
72+
73+
This is an example of the output from the Azure Resource Graph query:
74+
75+
```json
76+
{
77+
"properties":{
78+
"groupedBy": "severity",
79+
"smartGroupsCount": 100,
80+
"total": 9692,
81+
"values": [
82+
{
83+
"name": "Sev0",
84+
"count": 6517,
85+
"groupedby": "alertState",
86+
"values": [
87+
{
88+
"name": "New",
89+
"count": 6517
90+
},
91+
{
92+
"name": "Acknowledged",
93+
"count": 0
94+
},
95+
{
96+
"name": "Closed",
97+
"count": 0
98+
}
99+
]
100+
},
101+
{
102+
"name": "Sev1",
103+
"count": 3175,
104+
"groupedby": "alertState",
105+
"values": [
106+
{
107+
"name": "New",
108+
"count": 3175
109+
},
110+
{
111+
"name": "Acknowledged",
112+
"count": 0
113+
},
114+
{
115+
"name": "Closed",
116+
"count": 0
117+
}
118+
]
119+
},
120+
]
121+
}
122+
},
123+
"id": "/subscriptions/1a2b3c4d-123a-1234-a12b-a1b2c34d5e6f/providers/Microsoft.AlertsManagement/alertsSummary/current",
124+
"type": "Microsoft.AlertsManagement/alertsSummary",
125+
"name": "current"
126+
127+
```

articles/azure-monitor/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,6 +1604,8 @@ items:
16041604
href: essentials/rest-api-walkthrough.md
16051605
- name: Migrate to the metrics getBatch API
16061606
href: essentials/migrate-to-batch-api.md
1607+
- name: Migrate from the alertsSummary API
1608+
href: alerts/migrate-from-alerts-summary-api.md
16071609
- name: Azure alerts management SDK for Python
16081610
href: /python/api/azure-mgmt-monitor/azure.mgmt.monitor.monitormanagementclient
16091611
- name: Resource Manager templates

articles/governance/resource-graph/samples/starter.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ This article uses the following starter queries:
3131
- [List all storage accounts with specific tag value](#list-specific-tag)
3232
- [List all tags and their values](#list-all-tag-values)
3333
- [Show unassociated network security groups](#unassociated-nsgs)
34-
- [List alerts by severity](#alerts-severity)
35-
- [List alerts by severity and resource type](#alerts-severity-state)
36-
- [List alerts by severity and resource type with a specific tag](#alerts-severity-service-type)
34+
- [List alerts by severity](#list-azure-monitor-alerts-ordered-by-severity)
35+
- [List alerts by severity and resource type](#list-azure-monitor-alerts-ordered-by-severity-and-alert-state)
36+
- [List alerts by severity and resource type with a specific tag](#list-azure-monitor-alerts-ordered-by-severity-monitor-service-and-target-resource-type)
3737

3838
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free)
3939
before you begin.
@@ -657,7 +657,7 @@ Search-AzGraph -Query "Resources | where type =~ 'microsoft.network/networksecur
657657

658658
---
659659

660-
## <a name="alerts-severity"></a>List alerts ordered by severity
660+
## List Azure Monitor alerts ordered by severity
661661

662662
```kusto
663663
alertsmanagementresources
@@ -667,7 +667,7 @@ alertsmanagementresources
667667
| summarize AlertsCount = count() by Severity
668668
669669
```
670-
## <a name="alerts-severity-state"></a>List alerts ordered by severity and alert state
670+
## List Azure Monitor alerts ordered by severity and alert state
671671

672672
```kusto
673673
alertsmanagementresources
@@ -678,7 +678,7 @@ alertsmanagementresources
678678
| summarize AlertsCount = count() by Severity, AlertState
679679
```
680680

681-
## <a name="alerts-severity-service-type"></a>List alerts ordered by severity, monitor service, and target resource type
681+
## List Azure Monitor alerts ordered by severity, monitor service, and target resource type
682682

683683
```kusto
684684
alertsmanagementresources

0 commit comments

Comments
 (0)