Azure Resource Graph Explorer

How to display operating system details for Azure VMs

Suppose you want to generate a list of your Azure virtual machines and identify the operating system of each.  The portal displays useful information but only lists operating systems as Windows or Linux.  The Azure Resource Graph Explorer is available in the Azure portal and lets you query more detailed information.  Navigate to it by using the search bar.

Try running the following KQL query as an example of what can be generated.

| where type == "microsoft.compute/virtualmachines"
| extend vmName = properties.osProfile.computerName
| extend osOffer = properties.storageProfile.imageReference.offer
| extend osSku = properties.storageProfile.imageReference.sku
| extend osName = properties.extended.instanceView.osName
| extend osVersion = properties.extended.instanceView.osVersion
| project name, resourceGroup, location, vmName, osOffer, osSku, osName, osVersion

You can modify the query to filter or sort on VM attributes.  Then try this one and click on “See details” to show which properties are available for further query.

| where type == "microsoft.compute/virtualmachines"
| project properties

Results can be exported to a CSV file or the query can be pinned to a dashboard to display up-to-date VM information.

Check out the Microsoft page as a good start for writing Resource Graph queries.
Quickstart: Your first portal query – Azure Resource Graph | Microsoft Docs

About the author