Azure Resource Graph-Beispielabfragen für Azure Service Health

Diese Seite zeigt eine Sammlung von Azure Resource Graph-Beispielabfragen für Azure Service Health. Eine vollständige Liste mit den Azure Resource Graph-Beispielen finden Sie unter Resource Graph-Beispiele nach Kategorie und Resource Graph-Beispiele nach Tabelle.

Azure Service Health

Die Auswirkungen von Active Service Health-Ereignisabonnements

Hier werden alle aktiven Service Health Ereignisse zurückgegeben, einschließlich Dienstproblemen, geplanter Wartung, Integritätsratgebern und Sicherheitsratgebern – gruppiert nach Ereignistyp und der Anzahl der betroffenen Abonnements.

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"

Alle aktiven Ereignisse zur Integritätsempfehlung

Die aktiven Service Health Ereignisse zur Integritätsempfehlung werden an alle Abonnements zurückgegeben, auf die der Benutzer Zugriff hat.

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()"

Alle aktiven geplante Wartungsereignisse

Alle aktiven Service Health Ereignisse zur geplanten Wartung werden an alle Abonnements zurückgegeben, auf die der Benutzer Zugriff hat.

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()"

Alle aktiven Service Health Ereignisse

Die aktiven Service Health Ereignisse werden an alle Abonnements zurückgegeben, auf die der Benutzer Zugriff hat, einschließlich Dienstproblemen, geplanter Wartung, Integritätsempfehlungen und Sicherheitsempfehlungen.

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')"

Alle aktiven Dienstproblemereignisse

Die aktiven Service Health Ereignisse zu Dienstproblemen (Ausfälle) werden an alle Abonnements zurückgegeben, auf die der Benutzer Zugriff hat.

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'"

Bestätigte betroffene Ressourcen

Gibt alle betroffenen Ressourcen für alle Dienstprobleme (Ausfälle) und Service Health-Ereignisse für alle Abonnements zurück, auf die Benutzer Zugriff haben.

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"

Bestätigte betroffene Ressourcen mit weiteren Details

Gibt alle betroffenen Ressourcen für alle Dienstprobleme (Ausfälle) und Service Health-Ereignisse für alle Abonnements zurück, auf die Benutzer Zugriff haben. Diese Abfrage liefert auch weitere Details aus der resources-Tabelle.

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"

Ressourcenintegrität

Anzahl virtueller Computer nach Verfügbarkeitsstatus und Abonnement-ID

Gibt die Anzahl der virtuellen Computer (Typ Microsoft.Compute/virtualMachines) zurück, die nach ihrem Verfügbarkeitsstatus in den einzelnen Abonnements aggregiert wurden.

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)"

Liste der virtuellen Computer und ihres Verfügbarkeitsstatus nach Ressourcen-IDs

Gibt die aktuelle Liste der virtuellen Computer (Typ Microsoft.Compute/virtualMachines) zurück, die nach Verfügbarkeitsstatus aggregiert wurden. Die Abfrage stellt auch die zugeordnete Ressourcen-ID basierend auf properties.targetResourceId bereit, um das Debugging und die Entschärfung zu erleichtern. Der Verfügbarkeitsstatus kann einen von vier Werten haben: „Verfügbar“, „Nicht verfügbar“, „Heruntergestuft“ und „Unbekannt“. Ausführlichere Informationen zur Bedeutung der einzelnen Verfügbarkeitsstatus finden Sie unter Übersicht über Resource Health.

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)"

Liste der virtuellen Computer nach Verfügbarkeitsstatus und Energiezustand mit Ressourcen-IDs und Ressourcengruppen

Gibt eine Liste der virtuellen Computer (Typ Microsoft.Compute/virtualMachines) zurück, die nach ihrem Energiezustand und Verfügbarkeitsstatus aggregiert wurden, um einen einheitlichen Integritätszustand für Ihre virtuellen Computer bereitzustellen. Die Abfrage gibt zudem Details zur Ressourcengruppe und Ressourcen-ID an, die jedem Eintrag zugeordnet sind, um detaillierte Einblicke in Ihre Ressourcen zu ermöglichen.

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'"

Liste der virtuellen Computer, die nicht verfügbar sind, nach Ressourcen-IDs

Gibt die aktuelle Liste der virtuellen Computer (Typ Microsoft.Compute/virtualMachines) zurück, die nach Verfügbarkeitsstatus aggregiert wurden. In der aufgefüllten Liste sind nur virtuelle Computer hervorgehoben, deren Verfügbarkeitsstatus nicht „Verfügbar“ lautet, um Sie auf alle Ihre virtuellen Computer mit kritischem Status aufmerksam zu machen. Wenn alle Ihre virtuellen Computer verfügbar sind, können Sie davon ausgehen, dass Sie keine Ergebnisse erhalten.

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)"

Nächste Schritte