Hello, @LaVar Blalock !
How can I use a REST API to get the health of my VMs?
You can use the Azure Resource Health API or the Azure Monitor API to look at the health of a VM or other Azure resources. There are two Microsoft Developer blogs that go into this in detail:
- Understanding health criteria in Azure Monitor for VMs
The APIs can be used to identify what health criteria are applicable or active on a particular VM, and to get their IDs that are required for other API-related operations. Updates to health states are governed by two additional parameters, frequency and lookback period. Enabling or disabling an alert on a health criterion and updating the threshold of a Health Criteria can also be done using APIs. To associate Action group(s) with any of a VM’s health criteria, create a file titled “file_name” and update its extension to “.json”. - How to use Azure Resource Health API to gain visibility into the health of a VM, Web App or SQL Database
To identify what health criteria are applicable or active on a particular VM, and to get their IDs that are required for other API-related operations, use the following GET API example leveraging ARM client on command prompt shown below.
"subscriptions/Subscription_Name/resourceGroups/Resource_Group_Name/providers/Microsoft.Compute/virtualMachines/VM_Name/providers/Microsoft.WorkloadMonitor/monitors?api-version=2018-08-31-preview”