Azure Resource Graph-minta lekérdezések az Azure Service Health-hez

Ez a lap az Azure Service Health Azure Resource Graph-minta lekérdezéseinek gyűjteménye. Az Azure Resource Graph-minták teljes listáját lásd : Resource Graph-minták kategória és Resource Graph-minták táblázat szerint.

Azure Service Health

Az Active Service Health-esemény-előfizetés hatása

Az összes aktív Service Health-eseményt – beleértve a szolgáltatásproblémákat, a tervezett karbantartást, az állapottanácsokat és a biztonsági tanácsadásokat – adja vissza eseménytípus szerint csoportosítva, beleértve az érintett előfizetések számát is.

ServiceHealthResources
| where type =~ 'Microsoft.ResourceHealth/events'
| extend eventType = tostring(properties.EventType), status = properties.Status, description = properties.Title, trackingId = properties.TrackingId, summary = properties.Summary, priority = properties.Priority, impactStartTime = properties.ImpactStartTime, impactMitigationTime = properties.ImpactMitigationTime
| where eventType == 'ServiceIssue' and status == 'Active'
| summarize count(subscriptionId) by name
az graph query -q "ServiceHealthResources | where type =~ 'Microsoft.ResourceHealth/events' | extend eventType = tostring(properties.EventType), status = properties.Status, description = properties.Title, trackingId = properties.TrackingId, summary = properties.Summary, priority = properties.Priority, impactStartTime = properties.ImpactStartTime, impactMitigationTime = properties.ImpactMitigationTime | where eventType == 'ServiceIssue' and status == 'Active' | summarize count(subscriptionId) by name"

Minden aktív egészségügyi tanácsadási esemény

Az összes aktív állapottanácsadási Service Health-eseményt adja vissza az összes előfizetésben, amelyhez a felhasználó hozzáfér.

ServiceHealthResources
| where type =~ 'Microsoft.ResourceHealth/events'
| extend eventType = properties.EventType, status = properties.Status, description = properties.Title, trackingId = properties.TrackingId, summary = properties.Summary, priority = properties.Priority, impactStartTime = properties.ImpactStartTime, impactMitigationTime = todatetime(tolong(properties.ImpactMitigationTime))
| where eventType == 'HealthAdvisory' and impactMitigationTime > now()
az graph query -q "ServiceHealthResources | where type =~ 'Microsoft.ResourceHealth/events' | extend eventType = properties.EventType, status = properties.Status, description = properties.Title, trackingId = properties.TrackingId, summary = properties.Summary, priority = properties.Priority, impactStartTime = properties.ImpactStartTime, impactMitigationTime = todatetime(tolong(properties.ImpactMitigationTime)) | where eventType == 'HealthAdvisory' and impactMitigationTime > now()"

Minden aktív tervezett karbantartási esemény

Az összes aktív tervezett karbantartási Service Health-eseményt adja vissza az összes előfizetésben, amelyhez a felhasználó hozzáfér.

ServiceHealthResources
| where type =~ 'Microsoft.ResourceHealth/events'
| extend eventType = properties.EventType, status = properties.Status, description = properties.Title, trackingId = properties.TrackingId, summary = properties.Summary, priority = properties.Priority, impactStartTime = properties.ImpactStartTime, impactMitigationTime = todatetime(tolong(properties.ImpactMitigationTime))
| where eventType == 'PlannedMaintenance' and impactMitigationTime > now()
az graph query -q "ServiceHealthResources | where type =~ 'Microsoft.ResourceHealth/events' | extend eventType = properties.EventType, status = properties.Status, description = properties.Title, trackingId = properties.TrackingId, summary = properties.Summary, priority = properties.Priority, impactStartTime = properties.ImpactStartTime, impactMitigationTime = todatetime(tolong(properties.ImpactMitigationTime)) | where eventType == 'PlannedMaintenance' and impactMitigationTime > now()"

Minden aktív Service Health-esemény

Minden olyan előfizetés aktív Service Health-eseményét adja vissza, amelyhez a felhasználó hozzáféréssel rendelkezik, beleértve a szolgáltatásproblémákat, a tervezett karbantartást, az állapottal kapcsolatos tanácsadásokat és a biztonsági tanácsadásokat.

ServiceHealthResources
| where type =~ 'Microsoft.ResourceHealth/events'
| extend eventType = properties.EventType, status = properties.Status, description = properties.Title, trackingId = properties.TrackingId, summary = properties.Summary, priority = properties.Priority, impactStartTime = properties.ImpactStartTime, impactMitigationTime = properties.ImpactMitigationTime
| where (eventType in ('HealthAdvisory', 'SecurityAdvisory', 'PlannedMaintenance') and impactMitigationTime > now()) or (eventType == 'ServiceIssue' and status == 'Active')
az graph query -q "ServiceHealthResources | where type =~ 'Microsoft.ResourceHealth/events' | extend eventType = properties.EventType, status = properties.Status, description = properties.Title, trackingId = properties.TrackingId, summary = properties.Summary, priority = properties.Priority, impactStartTime = properties.ImpactStartTime, impactMitigationTime = properties.ImpactMitigationTime | where (eventType in ('HealthAdvisory', 'SecurityAdvisory', 'PlannedMaintenance') and impactMitigationTime > now()) or (eventType == 'ServiceIssue' and status == 'Active')"

Az összes aktív szolgáltatásproblémás esemény

Az összes aktív szolgáltatásproblémát (kimaradás) okozó Service Health-eseményt adja vissza az összes előfizetésben, amelyhez a felhasználó hozzáfér.

ServiceHealthResources
| where type =~ 'Microsoft.ResourceHealth/events'
| extend eventType = properties.EventType, status = properties.Status, description = properties.Title, trackingId = properties.TrackingId, summary = properties.Summary, priority = properties.Priority, impactStartTime = properties.ImpactStartTime, impactMitigationTime = properties.ImpactMitigationTime
| where eventType == 'ServiceIssue' and status == 'Active'
az graph query -q "ServiceHealthResources | where type =~ 'Microsoft.ResourceHealth/events' | extend eventType = properties.EventType, status = properties.Status, description = properties.Title, trackingId = properties.TrackingId, summary = properties.Summary, priority = properties.Priority, impactStartTime = properties.ImpactStartTime, impactMitigationTime = properties.ImpactMitigationTime | where eventType == 'ServiceIssue' and status == 'Active'"

Megerősített érintett erőforrások

Visszaadja az összes érintett erőforrást az összes szolgáltatásproblémához (kimaradás) tartozó Service Health-eseményhez minden olyan előfizetéshez, amelyhez a felhasználó hozzáfér.

ServiceHealthResources
| where type == "microsoft.resourcehealth/events/impactedresources"
| extend TrackingId = split(split(id, "/events/", 1)[0], "/impactedResources", 0)[0]
| extend p = parse_json(properties)
| project subscriptionId, TrackingId, resourceName= p.resourceName, resourceGroup=p.resourceGroup, resourceType=p.targetResourceType, details = p, id
az graph query -q "ServiceHealthResources | where type == 'microsoft.resourcehealth/events/impactedresources' | extend TrackingId = split(split(id, '/events/', 1)[0], '/impactedResources', 0)[0] | extend p = parse_json(properties) | project subscriptionId, TrackingId, resourceName= p.resourceName, resourceGroup=p.resourceGroup, resourceType=p.targetResourceType, details = p, id"

Megerősített érintett erőforrások további részletekkel

Visszaadja az összes érintett erőforrást az összes szolgáltatásproblémához (kimaradás) tartozó Service Health-eseményhez minden olyan előfizetéshez, amelyhez a felhasználó hozzáfér. Ez a lekérdezés további részleteket is tartalmaz a resources táblából.

servicehealthresources
| where type == "microsoft.resourcehealth/events/impactedresources"
| extend TrackingId = split(split(id, "/events/", 1)[0], "/impactedResources", 0)[0]
| extend p = parse_json(properties)
| project subscriptionId, TrackingId, targetResourceId= tostring(p.targetResourceId), details = p
| join kind=inner (
    resources
    )
    on $left.targetResourceId == $right.id
az graph query -q "ServiceHealthResources | where type == 'microsoft.resourcehealth/events/impactedresources' | extend TrackingId = split(split(id, '/events/', 1)[0], '/impactedResources', 0)[0] | extend p =  parse_json(properties) | project subscriptionId, TrackingId, targetResourceId = tostring(p.targetResourceId), details = p | join kind=inner (resources) on $left.targetResourceId == $right.id"

Erőforrás állapota

Virtuális gépek száma rendelkezésre állási állapot és előfizetés-azonosító szerint

A virtuális gépek (típus Microsoft.Compute/virtualMachines) számát adja vissza az egyes előfizetések rendelkezésre állási állapota alapján összesítve.

HealthResources
| where type =~ 'microsoft.resourcehealth/availabilitystatuses'
| summarize count() by subscriptionId, AvailabilityState = tostring(properties.availabilityState)
az graph query -q "HealthResources | where type =~ 'microsoft.resourcehealth/availabilitystatuses' | summarize count() by subscriptionId, AvailabilityState = tostring(properties.availabilityState)"

Virtuális gépek és társított rendelkezésre állási állapotok listája erőforrás-azonosítók szerint

A virtuális gépek (típus Microsoft.Compute/virtualMachines) legfrissebb listáját adja vissza a rendelkezésre állási állapot szerint összesítve. A lekérdezés emellett a társított erőforrás-azonosítót is megadja az properties.targetResourceIdegyszerű hibakereséshez és a hibaelhárításhoz. A rendelkezésre állási állapotok négy érték egyike lehet: Elérhető, Nem érhető el, Csökkentett és Ismeretlen. Az egyes rendelkezésre állási állapotok lényegéről az Azure Resource Health áttekintésében olvashat bővebben.

HealthResources
| where type =~ 'microsoft.resourcehealth/availabilitystatuses'
| summarize by ResourceId = tolower(tostring(properties.targetResourceId)), AvailabilityState = tostring(properties.availabilityState)
az graph query -q "HealthResources | where type =~ 'microsoft.resourcehealth/availabilitystatuses' | summarize by ResourceId = tolower(tostring(properties.targetResourceId)), AvailabilityState = tostring(properties.availabilityState)"

Virtuális gépek listája rendelkezésre állási állapot és energiaállapot szerint erőforrás-azonosítókkal és erőforráscsoportokkal

A virtuális gépek (típus Microsoft.Compute/virtualMachines) összesített listáját adja vissza az energiaállapotuk és a rendelkezésre állási állapotuk alapján, hogy egységes állapotot biztosítsanak a virtuális gépek számára. A lekérdezés az egyes bejegyzésekhez társított erőforráscsoportra és erőforrás-azonosítóra vonatkozó részleteket is tartalmaz az erőforrások részletes láthatósága érdekében.

Resources
| where type =~ 'microsoft.compute/virtualmachines'
| project resourceGroup, Id = tolower(id), PowerState = tostring( properties.extended.instanceView.powerState.code)
| join kind=leftouter (
	HealthResources
	| where type =~ 'microsoft.resourcehealth/availabilitystatuses'
	| where tostring(properties.targetResourceType) =~ 'microsoft.compute/virtualmachines'
	| project targetResourceId = tolower(tostring(properties.targetResourceId)), AvailabilityState = tostring(properties.availabilityState))
	on $left.Id == $right.targetResourceId
| project-away targetResourceId
| where PowerState != 'PowerState/deallocated'
az graph query -q "Resources | where type =~ 'microsoft.compute/virtualmachines' | project resourceGroup, Id = tolower(id), PowerState = tostring( properties.extended.instanceView.powerState.code) | join kind=leftouter ( HealthResources | where type =~ 'microsoft.resourcehealth/availabilitystatuses' | where tostring(properties.targetResourceType) =~ 'microsoft.compute/virtualmachines' | project targetResourceId = tolower(tostring(properties.targetResourceId)), AvailabilityState = tostring(properties.availabilityState)) on \$left.Id == \$right.targetResourceId | project-away targetResourceId | where PowerState != 'PowerState/deallocated'"

Az erőforrás-azonosítók által nem elérhető virtuális gépek listája

A virtuális gépek (típus Microsoft.Compute/virtualMachines) legfrissebb listáját adja vissza a rendelkezésre állási állapotuk alapján összesítve. A feltöltött lista csak azokat a virtuális gépeket emeli ki, amelyek rendelkezésre állási állapota nem "Elérhető", így biztos lehet benne, hogy tisztában van a virtuális gépek összes érintett állapotával. Ha az összes virtuális gép elérhető, várhatóan nem fog eredményt kapni.

HealthResources
| where type =~ 'microsoft.resourcehealth/availabilitystatuses'
| where tostring(properties.availabilityState) != 'Available'
| summarize by ResourceId = tolower(tostring(properties.targetResourceId)), AvailabilityState = tostring(properties.availabilityState)
az graph query -q "HealthResources | where type =~ 'microsoft.resourcehealth/availabilitystatuses' | where tostring(properties.availabilityState) != 'Available' | summarize by ResourceId = tolower(tostring(properties.targetResourceId)), AvailabilityState = tostring(properties.availabilityState)"

Következő lépések