Skip to content

Instantly share code, notes, and snippets.

@blakedrumm
Created May 19, 2025 21:13
Show Gist options
  • Save blakedrumm/575da5807a18fc412c2d9627b750ba22 to your computer and use it in GitHub Desktop.
Save blakedrumm/575da5807a18fc412c2d9627b750ba22 to your computer and use it in GitHub Desktop.
Retrieves Azure Arc-enabled machines with their agent version, OS version, status, cloud provider, and last status change timestamp (in UTC). Helps identify machines with outdated Arc agents or stale status updates.
resources
| where type == "microsoft.hybridcompute/machines"
| extend
ArcAgentVersion = tostring(properties.agentVersion),
OSVersion = tostring(properties.osSku),
MachineName = tostring(properties.machineFqdn),
Status = tostring(properties.status),
LastStatusChangeRaw = todatetime(properties.lastStatusChange),
LastStatusChangeUTC = format_datetime(todatetime(properties.lastStatusChange), 'yyyy-MM-dd HH:mm:ss'),
Provider = tostring(properties['cloudMetadata']['provider'])
| project MachineName, ArcAgentVersion, OSVersion, Status, Provider, LastStatusChangeUTC
| order by ArcAgentVersion desc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment