Skip to content

Commit f0b91fb

Browse files
Add new queries
1 parent 5464939 commit f0b91fb

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

includes/resource-graph/samples/bytable/healthresourcechanges.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,22 @@ HealthResourceChanges
2121
# [Azure CLI](#tab/azure-cli)
2222

2323
```azurecli-interactive
24-
az graph query -q ""
24+
az graph query -q "HealthResourceChanges | where properties.targetResourceType =~ 'microsoft.resourcehealth/resourceannotations' | where properties['changes']['properties.category']['newValue'] =~ 'Planned' | project Id = tostring(split(tolower(properties.targetResourceId), '/providers/microsoft.resourcehealth/resourceannotations')[0]), Reason = properties['changes']['properties.reason']['newValue']"
2525
```
2626

2727
# [Azure PowerShell](#tab/azure-powershell)
2828

2929
```azurepowershell-interactive
30-
Search-AzGraph -Query ""
30+
Search-AzGraph -Query "HealthResourceChanges | where properties.targetResourceType =~ 'microsoft.resourcehealth/resourceannotations' | where properties['changes']['properties.category']['newValue'] =~ 'Planned' | project Id = tostring(split(tolower(properties.targetResourceId), '/providers/microsoft.resourcehealth/resourceannotations')[0]), Reason = properties['changes']['properties.reason']['newValue']"
3131
```
3232

3333
# [Portal](#tab/azure-portal)
3434

3535
:::image type="icon" source="../../../../articles/governance/resource-graph/media/resource-graph-small.png"::: Try this query in Azure Resource Graph Explorer:
3636

37-
- Azure portal: <a href="https://portal.azure.com/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/ " target="_blank">portal.Azure.com</a>
38-
- Azure Government portal: <a href="https://portal.azure.us/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/ " target="_blank">portal.Azure.us</a>
39-
- Azure China 21Vianet portal: <a href="https://portal.azure.cn/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/ " target="_blank">portal.Azure.cn</a>
37+
- Azure portal: <a href="https://portal.azure.com/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/HealthResourceChanges%20%7C%20where%20properties.targetResourceType%20%3D~%20%27microsoft.resourcehealth%2Fresourceannotations%27%20%7C%20where%20properties%5B%27changes%27%5D%5B%27properties.category%27%5D%5B%27newValue%27%5D%20%3D~%20%27Planned%27%20%7C%20project%20Id%20%3D%20tostring%28split%28tolower%28properties.targetResourceId%29%2C%20%27%2Fproviders%2Fmicrosoft.resourcehealth%2Fresourceannotations%27%29%5B0%5D%29%2C%20Reason%20%3D%20properties%5B%27changes%27%5D%5B%27properties.reason%27%5D%5B%27newValue%27%5D" target="_blank">portal.Azure.com</a>
38+
- Azure Government portal: <a href="https://portal.azure.us/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/HealthResourceChanges%20%7C%20where%20properties.targetResourceType%20%3D~%20%27microsoft.resourcehealth%2Fresourceannotations%27%20%7C%20where%20properties%5B%27changes%27%5D%5B%27properties.category%27%5D%5B%27newValue%27%5D%20%3D~%20%27Planned%27%20%7C%20project%20Id%20%3D%20tostring%28split%28tolower%28properties.targetResourceId%29%2C%20%27%2Fproviders%2Fmicrosoft.resourcehealth%2Fresourceannotations%27%29%5B0%5D%29%2C%20Reason%20%3D%20properties%5B%27changes%27%5D%5B%27properties.reason%27%5D%5B%27newValue%27%5D" target="_blank">portal.Azure.us</a>
39+
- Azure China 21Vianet portal: <a href="https://portal.azure.cn/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/HealthResourceChanges%20%7C%20where%20properties.targetResourceType%20%3D~%20%27microsoft.resourcehealth%2Fresourceannotations%27%20%7C%20where%20properties%5B%27changes%27%5D%5B%27properties.category%27%5D%5B%27newValue%27%5D%20%3D~%20%27Planned%27%20%7C%20project%20Id%20%3D%20tostring%28split%28tolower%28properties.targetResourceId%29%2C%20%27%2Fproviders%2Fmicrosoft.resourcehealth%2Fresourceannotations%27%29%5B0%5D%29%2C%20Reason%20%3D%20properties%5B%27changes%27%5D%5B%27properties.reason%27%5D%5B%27newValue%27%5D" target="_blank">portal.Azure.cn</a>
4040

4141
---
4242

@@ -59,22 +59,22 @@ Context = properties['changes']['properties.context']['newValue'], Category = pr
5959
# [Azure CLI](#tab/azure-cli)
6060

6161
```azurecli-interactive
62-
az graph query -q ""
62+
az graph query -q "healthresourcechanges | where type == "microsoft.resources/changes" | where properties.targetResourceType =~ "microsoft.resourcehealth/resourceannotations" | extend Id = tolower(split(properties.targetResourceId, '/providers/Microsoft.ResourceHealth/resourceAnnotations/current')[0]), Timestamp = todatetime(properties.changeAttributes.timestamp), AnnotationName = properties['changes']['properties.annotationName']['newValue'], Reason = properties['changes']['properties.reason']['newValue'], Context = properties['changes']['properties.context']['newValue'], Category = properties['changes']['properties.category']['newValue'] | where isnotempty(AnnotationName) | project Timestamp, Id, PreviousAnnotation = properties['changes']['properties.annotationName']['previousValue'], AnnotationName, Reason, Context, Category | order by Timestamp desc"
6363
```
6464

6565
# [Azure PowerShell](#tab/azure-powershell)
6666

6767
```azurepowershell-interactive
68-
Search-AzGraph -Query ""
68+
Search-AzGraph -Query "healthresourcechanges | where type == "microsoft.resources/changes" | where properties.targetResourceType =~ "microsoft.resourcehealth/resourceannotations" | extend Id = tolower(split(properties.targetResourceId, '/providers/Microsoft.ResourceHealth/resourceAnnotations/current')[0]), Timestamp = todatetime(properties.changeAttributes.timestamp), AnnotationName = properties['changes']['properties.annotationName']['newValue'], Reason = properties['changes']['properties.reason']['newValue'], Context = properties['changes']['properties.context']['newValue'], Category = properties['changes']['properties.category']['newValue'] | where isnotempty(AnnotationName) | project Timestamp, Id, PreviousAnnotation = properties['changes']['properties.annotationName']['previousValue'], AnnotationName, Reason, Context, Category | order by Timestamp desc"
6969
```
7070

7171
# [Portal](#tab/azure-portal)
7272

7373
:::image type="icon" source="../../../../articles/governance/resource-graph/media/resource-graph-small.png"::: Try this query in Azure Resource Graph Explorer:
7474

75-
- Azure portal: <a href="https://portal.azure.com/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/ " target="_blank">portal.Azure.com</a>
76-
- Azure Government portal: <a href="https://portal.azure.us/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/ " target="_blank">portal.Azure.us</a>
77-
- Azure China 21Vianet portal: <a href="https://portal.azure.cn/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/ " target="_blank">portal.Azure.cn</a>
75+
- Azure portal: <a href="https://portal.azure.com/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/healthresourcechanges%20%7C%20where%20type%20%3D%3D%20%22microsoft.resources%2Fchanges%22%20%7C%20where%20properties.targetResourceType%20%3D~%20%22microsoft.resourcehealth%2Fresourceannotations%22%20%7C%20extend%20Id%20%3D%20tolower%28split%28properties.targetResourceId%2C%20%27%2Fproviders%2FMicrosoft.ResourceHealth%2FresourceAnnotations%2Fcurrent%27%29%5B0%5D%29%2C%20Timestamp%20%3D%20todatetime%28properties.changeAttributes.timestamp%29%2C%20AnnotationName%20%3D%20properties%5B%27changes%27%5D%5B%27properties.annotationName%27%5D%5B%27newValue%27%5D%2C%20Reason%20%3D%20properties%5B%27changes%27%5D%5B%27properties.reason%27%5D%5B%27newValue%27%5D%2C%20Context%20%3D%20properties%5B%27changes%27%5D%5B%27properties.context%27%5D%5B%27newValue%27%5D%2C%20Category%20%3D%20properties%5B%27changes%27%5D%5B%27properties.category%27%5D%5B%27newValue%27%5D%20%7C%20where%20isnotempty%28AnnotationName%29%20%7C%20project%20Timestamp%2C%20Id%2C%20PreviousAnnotation%20%3D%20properties%5B%27changes%27%5D%5B%27properties.annotationName%27%5D%5B%27previousValue%27%5D%2C%20AnnotationName%2C%20Reason%2C%20Context%2C%20Category%20%7C%20order%20by%20Timestamp%20desc" target="_blank">portal.Azure.com</a>
76+
- Azure Government portal: <a href="https://portal.azure.us/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/healthresourcechanges%20%7C%20where%20type%20%3D%3D%20%22microsoft.resources%2Fchanges%22%20%7C%20where%20properties.targetResourceType%20%3D~%20%22microsoft.resourcehealth%2Fresourceannotations%22%20%7C%20extend%20Id%20%3D%20tolower%28split%28properties.targetResourceId%2C%20%27%2Fproviders%2FMicrosoft.ResourceHealth%2FresourceAnnotations%2Fcurrent%27%29%5B0%5D%29%2C%20Timestamp%20%3D%20todatetime%28properties.changeAttributes.timestamp%29%2C%20AnnotationName%20%3D%20properties%5B%27changes%27%5D%5B%27properties.annotationName%27%5D%5B%27newValue%27%5D%2C%20Reason%20%3D%20properties%5B%27changes%27%5D%5B%27properties.reason%27%5D%5B%27newValue%27%5D%2C%20Context%20%3D%20properties%5B%27changes%27%5D%5B%27properties.context%27%5D%5B%27newValue%27%5D%2C%20Category%20%3D%20properties%5B%27changes%27%5D%5B%27properties.category%27%5D%5B%27newValue%27%5D%20%7C%20where%20isnotempty%28AnnotationName%29%20%7C%20project%20Timestamp%2C%20Id%2C%20PreviousAnnotation%20%3D%20properties%5B%27changes%27%5D%5B%27properties.annotationName%27%5D%5B%27previousValue%27%5D%2C%20AnnotationName%2C%20Reason%2C%20Context%2C%20Category%20%7C%20order%20by%20Timestamp%20desc" target="_blank">portal.Azure.us</a>
77+
- Azure China 21Vianet portal: <a href="https://portal.azure.cn/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/healthresourcechanges%20%7C%20where%20type%20%3D%3D%20%22microsoft.resources%2Fchanges%22%20%7C%20where%20properties.targetResourceType%20%3D~%20%22microsoft.resourcehealth%2Fresourceannotations%22%20%7C%20extend%20Id%20%3D%20tolower%28split%28properties.targetResourceId%2C%20%27%2Fproviders%2FMicrosoft.ResourceHealth%2FresourceAnnotations%2Fcurrent%27%29%5B0%5D%29%2C%20Timestamp%20%3D%20todatetime%28properties.changeAttributes.timestamp%29%2C%20AnnotationName%20%3D%20properties%5B%27changes%27%5D%5B%27properties.annotationName%27%5D%5B%27newValue%27%5D%2C%20Reason%20%3D%20properties%5B%27changes%27%5D%5B%27properties.reason%27%5D%5B%27newValue%27%5D%2C%20Context%20%3D%20properties%5B%27changes%27%5D%5B%27properties.context%27%5D%5B%27newValue%27%5D%2C%20Category%20%3D%20properties%5B%27changes%27%5D%5B%27properties.category%27%5D%5B%27newValue%27%5D%20%7C%20where%20isnotempty%28AnnotationName%29%20%7C%20project%20Timestamp%2C%20Id%2C%20PreviousAnnotation%20%3D%20properties%5B%27changes%27%5D%5B%27properties.annotationName%27%5D%5B%27previousValue%27%5D%2C%20AnnotationName%2C%20Reason%2C%20Context%2C%20Category%20%7C%20order%20by%20Timestamp%20desc" target="_blank">portal.Azure.cn</a>
7878

7979
---
8080

@@ -97,22 +97,22 @@ LatestAvailabilityState = properties['changes']['properties.availabilityState'][
9797
# [Azure CLI](#tab/azure-cli)
9898

9999
```azurecli-interactive
100-
az graph query -q ""
100+
az graph query -q "healthresourcechanges | where type == "microsoft.resources/changes" | where properties.targetResourceType =~ "microsoft.resourcehealth/availabilityStatuses" | extend Id = tolower(split(properties.targetResourceId, '/providers/Microsoft.ResourceHealth/availabilityStatuses/current')[0]), Timestamp = todatetime(properties.changeAttributes.timestamp), PreviousAvailabilityState = properties['changes']['properties.availabilityState']['previousValue'], LatestAvailabilityState = properties['changes']['properties.availabilityState']['newValue'] | where isnotempty(LatestAvailabilityState) | project Timestamp, Id, PreviousAvailabilityState, LatestAvailabilityState | order by Timestamp desc"
101101
```
102102

103103
# [Azure PowerShell](#tab/azure-powershell)
104104

105105
```azurepowershell-interactive
106-
Search-AzGraph -Query ""
106+
Search-AzGraph -Query "healthresourcechanges | where type == "microsoft.resources/changes" | where properties.targetResourceType =~ "microsoft.resourcehealth/availabilityStatuses" | extend Id = tolower(split(properties.targetResourceId, '/providers/Microsoft.ResourceHealth/availabilityStatuses/current')[0]), Timestamp = todatetime(properties.changeAttributes.timestamp), PreviousAvailabilityState = properties['changes']['properties.availabilityState']['previousValue'], LatestAvailabilityState = properties['changes']['properties.availabilityState']['newValue'] | where isnotempty(LatestAvailabilityState) | project Timestamp, Id, PreviousAvailabilityState, LatestAvailabilityState | order by Timestamp desc"
107107
```
108108

109109
# [Portal](#tab/azure-portal)
110110

111111
:::image type="icon" source="../../../../articles/governance/resource-graph/media/resource-graph-small.png"::: Try this query in Azure Resource Graph Explorer:
112112

113-
- Azure portal: <a href="https://portal.azure.com/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/ " target="_blank">portal.Azure.com</a>
114-
- Azure Government portal: <a href="https://portal.azure.us/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/ " target="_blank">portal.Azure.us</a>
115-
- Azure China 21Vianet portal: <a href="https://portal.azure.cn/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/ " target="_blank">portal.Azure.cn</a>
113+
- Azure portal: <a href="https://portal.azure.com/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/healthresourcechanges%20%7C%20where%20type%20%3D%3D%20%22microsoft.resources%2Fchanges%22%20%7C%20where%20properties.targetResourceType%20%3D~%20%22microsoft.resourcehealth%2FavailabilityStatuses%22%20%7C%20extend%20Id%20%3D%20tolower%28split%28properties.targetResourceId%2C%20%27%2Fproviders%2FMicrosoft.ResourceHealth%2FavailabilityStatuses%2Fcurrent%27%29%5B0%5D%29%2C%20Timestamp%20%3D%20todatetime%28properties.changeAttributes.timestamp%29%2C%20PreviousAvailabilityState%20%3D%20properties%5B%27changes%27%5D%5B%27properties.availabilityState%27%5D%5B%27previousValue%27%5D%2C%20LatestAvailabilityState%20%3D%20properties%5B%27changes%27%5D%5B%27properties.availabilityState%27%5D%5B%27newValue%27%5D%20%7C%20where%20isnotempty%28LatestAvailabilityState%29%20%7C%20project%20Timestamp%2C%20Id%2C%20PreviousAvailabilityState%2C%20LatestAvailabilityState%20%7C%20order%20by%20Timestamp%20desc" target="_blank">portal.Azure.com</a>
114+
- Azure Government portal: <a href="https://portal.azure.us/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/healthresourcechanges%20%7C%20where%20type%20%3D%3D%20%22microsoft.resources%2Fchanges%22%20%7C%20where%20properties.targetResourceType%20%3D~%20%22microsoft.resourcehealth%2FavailabilityStatuses%22%20%7C%20extend%20Id%20%3D%20tolower%28split%28properties.targetResourceId%2C%20%27%2Fproviders%2FMicrosoft.ResourceHealth%2FavailabilityStatuses%2Fcurrent%27%29%5B0%5D%29%2C%20Timestamp%20%3D%20todatetime%28properties.changeAttributes.timestamp%29%2C%20PreviousAvailabilityState%20%3D%20properties%5B%27changes%27%5D%5B%27properties.availabilityState%27%5D%5B%27previousValue%27%5D%2C%20LatestAvailabilityState%20%3D%20properties%5B%27changes%27%5D%5B%27properties.availabilityState%27%5D%5B%27newValue%27%5D%20%7C%20where%20isnotempty%28LatestAvailabilityState%29%20%7C%20project%20Timestamp%2C%20Id%2C%20PreviousAvailabilityState%2C%20LatestAvailabilityState%20%7C%20order%20by%20Timestamp%20desc" target="_blank">portal.Azure.us</a>
115+
- Azure China 21Vianet portal: <a href="https://portal.azure.cn/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/healthresourcechanges%20%7C%20where%20type%20%3D%3D%20%22microsoft.resources%2Fchanges%22%20%7C%20where%20properties.targetResourceType%20%3D~%20%22microsoft.resourcehealth%2FavailabilityStatuses%22%20%7C%20extend%20Id%20%3D%20tolower%28split%28properties.targetResourceId%2C%20%27%2Fproviders%2FMicrosoft.ResourceHealth%2FavailabilityStatuses%2Fcurrent%27%29%5B0%5D%29%2C%20Timestamp%20%3D%20todatetime%28properties.changeAttributes.timestamp%29%2C%20PreviousAvailabilityState%20%3D%20properties%5B%27changes%27%5D%5B%27properties.availabilityState%27%5D%5B%27previousValue%27%5D%2C%20LatestAvailabilityState%20%3D%20properties%5B%27changes%27%5D%5B%27properties.availabilityState%27%5D%5B%27newValue%27%5D%20%7C%20where%20isnotempty%28LatestAvailabilityState%29%20%7C%20project%20Timestamp%2C%20Id%2C%20PreviousAvailabilityState%2C%20LatestAvailabilityState%20%7C%20order%20by%20Timestamp%20desc" target="_blank">portal.Azure.cn</a>
116116

117117
---
118118

0 commit comments

Comments
 (0)