vm_activity
Investigates Azure VM activity logs over a time window to show who operated the VM and which events Azure raised, helping determine whether a restart was user- or platform-initiated.
Instructions
What happened to an Azure VM in a time window: operations people ran, and events Azure raised.
Azure Resource Manager in the DEFAULT tenant only, also when several tenants are
configured (ENTRAADM_CONFIG).
Answers "did someone restart this VM, or did Azure?" from the Azure activity
log of the VM's subscription. Read-only; needs the Reader role on the
subscription. Two reads: the VM's resource group (server-side filter, so a
busy subscription cannot crowd the VM's own events out of the page budget)
feeds health and vm_operations; the whole subscription feeds the rest.
health: Resource Health events of the VM (causePlatformInitiated= Azure, e.g.Redeploying due to host failure;UserInitiated= an operation on the VM, orReboot initiated from inside the machinefor a restart from the guest OS).vm_operations: Administrative events on the VM and its sub-resources (restart, deallocate, redeploy, extension changes), withcaller(a user principal name or an application id). One operation usually logs several events (Started, Accepted, Succeeded) sharing acorrelation_id.other_operations: Administrative events on any other resource of the subscription (countof events,operations= distinct correlation ids,items= the newest 50). Zero here and invm_operationsmeans nobody operated the subscription through Azure Resource Manager in the window; it says nothing about actions inside the guest OS.service_health: Azure incidents and planned maintenance announced to the subscription.other_categories: counts of the remaining categories (Alert, Policy, other resources' health events, ...).
vm is the VM name, matched case-insensitively across the
subscriptions this credential can see; narrow it with subscription
(id or display name from list_subscriptions) or resource_group
when the name is not unique (ambiguous lists the candidates). A
single match found while some subscription could not be listed
completely is not taken as unique: it comes back as candidates with
search_complete: false, to be confirmed by naming its subscription.
Naming the subscription also keeps the search short: without it every
visible subscription is listed, and the search may use at most half of
the call's time budget.
The window is start..end (ISO timestamps with an offset, e.g.
2026-10-21T21:00:00+09:00; seconds may be omitted), or the hours
before end (default 24; end defaults to now); at most 168 hours,
within the 90 days the activity log keeps. Times in the result are UTC as
Azure returns them. capped marks a read cut short by the page or time
budget (capped_reads says which): then an empty section is not proof
that nothing happened.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| vm | Yes | ||
| end | No | ||
| hours | No | ||
| start | No | ||
| max_pages | No | ||
| subscription | No | ||
| resource_group | No |