1 min read

KQL Query - Azure Arc for Servers Resource Health

KQL Query - Azure Arc for Servers Resource Health
KQL Query - Azure Arc for Servers Resource Health

When using Azure Arc for Servers, if the agent installed on your servers experiences a disconnection, you can track this event by observing the "ResourceHealth" entries in the AzureActivity table. If the connection is lost, the ActivityStatusValue for these entries will be set to "Active". Once the connection is reestablished, the ActivityStatusValue will be changed to "Resolved". By analyzing this data, we can determine how frequently and for how long each server was disconnected. While brief disconnections may be acceptable, prolonged disconnections warrant further investigation.

To assist in this analysis, I have created the following KQL query.

AzureActivity
| where CategoryValue == "ResourceHealth"
| where ActivityStatusValue == "Active"
| extend ResourceType = Properties_d.resourceProviderValue
| where ResourceType == "MICROSOFT.HYBRIDCOMPUTE"
| extend StartTime = TimeGenerated
| extend ServerName = Properties_d.resource
| join kind=leftouter (AzureActivity  
    | where ActivityStatusValue == "Resolved"
    | extend ResourceType = Properties_d.resourceProviderValue
    | where ResourceType == "MICROSOFT.HYBRIDCOMPUTE"
    | extend EndTime = TimeGenerated
)  
    on CorrelationId
| extend ["Minutes Offline"] = datetime_diff('minute',EndTime,StartTime)
| project ServerName,StartTime,EndTime,["Minutes Offline"],CorrelationId
Azure Arc for Servers results

Summary

Are you looking to improve your organization's security and gain better visibility into potential threats? Contact me today and I can help you implement Microsoft Sentinel, a powerful security platform that uses artificial intelligence and machine learning to help you detect, investigate, and respond to security incidents.