|
| 1 | +--- |
| 2 | +author: timwarner-msft |
| 3 | +ms.service: resource-graph |
| 4 | +ms.topic: include |
| 5 | +ms.date: 02/14/2023 |
| 6 | +ms.author: timwarner |
| 7 | +ms.custom: generated |
| 8 | +--- |
| 9 | + |
| 10 | +### Azure VMs impacted by Azure-initiated maintenance |
| 11 | + |
| 12 | +Returns a list of virtual machines (VMs) impacted by routine Azure-initiated maintenance operations in the past 14 days, along with the corresponding reason for impact. |
| 13 | + |
| 14 | +```kusto |
| 15 | +HealthResourceChanges |
| 16 | +| where properties.targetResourceType =~ 'microsoft.resourcehealth/resourceannotations' |
| 17 | +| where properties['changes']['properties.category']['newValue'] =~ 'Planned' |
| 18 | +| project Id = tostring(split(tolower(properties.targetResourceId), '/providers/microsoft.resourcehealth/resourceannotations')[0]), Reason = properties['changes']['properties.reason']['newValue'] |
| 19 | +``` |
| 20 | + |
| 21 | +# [Azure CLI](#tab/azure-cli) |
| 22 | + |
| 23 | +```azurecli-interactive |
| 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']" |
| 25 | +``` |
| 26 | + |
| 27 | +# [Azure PowerShell](#tab/azure-powershell) |
| 28 | + |
| 29 | +```azurepowershell-interactive |
| 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']" |
| 31 | +``` |
| 32 | + |
| 33 | +# [Portal](#tab/azure-portal) |
| 34 | + |
| 35 | +:::image type="icon" source="../../../../articles/governance/resource-graph/media/resource-graph-small.png"::: Try this query in Azure Resource Graph Explorer: |
| 36 | + |
| 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> |
| 40 | + |
| 41 | +--- |
| 42 | + |
| 43 | +### Changes to health annotations over past 14 days |
| 44 | + |
| 45 | +Returns a list of all changes to health annotations in the past 14 days. Nulls indicate there was no update to that specific field, corresponding to a change in the `Annotation Name` field) |
| 46 | + |
| 47 | +```kusto |
| 48 | +healthresourcechanges |
| 49 | +| where type == "microsoft.resources/changes" |
| 50 | +| where properties.targetResourceType =~ "microsoft.resourcehealth/resourceannotations" |
| 51 | +| extend Id = tolower(split(properties.targetResourceId, '/providers/Microsoft.ResourceHealth/resourceAnnotations/current')[0]), |
| 52 | +Timestamp = todatetime(properties.changeAttributes.timestamp), AnnotationName = properties['changes']['properties.annotationName']['newValue'], Reason = properties['changes']['properties.reason']['newValue'], |
| 53 | +Context = properties['changes']['properties.context']['newValue'], Category = properties['changes']['properties.category']['newValue'] |
| 54 | +| where isnotempty(AnnotationName) |
| 55 | +| project Timestamp, Id, PreviousAnnotation = properties['changes']['properties.annotationName']['previousValue'], AnnotationName, Reason, Context, Category |
| 56 | +| order by Timestamp desc |
| 57 | +``` |
| 58 | + |
| 59 | +# [Azure CLI](#tab/azure-cli) |
| 60 | + |
| 61 | +```azurecli-interactive |
| 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" |
| 63 | +``` |
| 64 | + |
| 65 | +# [Azure PowerShell](#tab/azure-powershell) |
| 66 | + |
| 67 | +```azurepowershell-interactive |
| 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" |
| 69 | +``` |
| 70 | + |
| 71 | +# [Portal](#tab/azure-portal) |
| 72 | + |
| 73 | +:::image type="icon" source="../../../../articles/governance/resource-graph/media/resource-graph-small.png"::: Try this query in Azure Resource Graph Explorer: |
| 74 | + |
| 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> |
| 78 | + |
| 79 | +--- |
| 80 | + |
| 81 | +### VM availability state changes over past 14 days |
| 82 | + |
| 83 | +Returns a list of all changes to VM availability states in the past 14 days. |
| 84 | + |
| 85 | +```kusto |
| 86 | +healthresourcechanges |
| 87 | +| where type == "microsoft.resources/changes" |
| 88 | +| where properties.targetResourceType =~ "microsoft.resourcehealth/availabilityStatuses" |
| 89 | +| extend Id = tolower(split(properties.targetResourceId, '/providers/Microsoft.ResourceHealth/availabilityStatuses/current')[0]), |
| 90 | +Timestamp = todatetime(properties.changeAttributes.timestamp), PreviousAvailabilityState = properties['changes']['properties.availabilityState']['previousValue'], |
| 91 | +LatestAvailabilityState = properties['changes']['properties.availabilityState']['newValue'] |
| 92 | +| where isnotempty(LatestAvailabilityState) |
| 93 | +| project Timestamp, Id, PreviousAvailabilityState, LatestAvailabilityState |
| 94 | +| order by Timestamp desc |
| 95 | +``` |
| 96 | + |
| 97 | +# [Azure CLI](#tab/azure-cli) |
| 98 | + |
| 99 | +```azurecli-interactive |
| 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" |
| 101 | +``` |
| 102 | + |
| 103 | +# [Azure PowerShell](#tab/azure-powershell) |
| 104 | + |
| 105 | +```azurepowershell-interactive |
| 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" |
| 107 | +``` |
| 108 | + |
| 109 | +# [Portal](#tab/azure-portal) |
| 110 | + |
| 111 | +:::image type="icon" source="../../../../articles/governance/resource-graph/media/resource-graph-small.png"::: Try this query in Azure Resource Graph Explorer: |
| 112 | + |
| 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> |
| 116 | + |
| 117 | +--- |
| 118 | + |
0 commit comments