Search code examples
azurekqlazure-resource-graph

How to find Windows version on Virtual Machines through Azure portal


How can I find what windows version is running on my Virtual Machines through Azure portal?

We have about 60 resource groups with virtual machines and we are planning to upgrade all Windows server 2012, but first we need an overview of how many machines we have running with server 2012.

By googling I only found this prameter, but it only gives me if it's Windows or Linux. How can I get windows version as well?

properties.storageProfile.osDisk.osType


Solution

  • If you want to pull the windows versions of your virtual machines, you can below resource graph explorer query from the portal.

    Here is the sample query:

    resources
    | where type == "microsoft.compute/virtualmachines"  and properties.storageProfile.imageReference.offer == "WindowsServer"
    | project name,offer=properties.storageProfile.imageReference.offer,sku=properties.storageProfile.imageReference.sku,version=properties.storageProfile.imageReference.version,minorversion=properties.storageProfile.imageReference.exactVersion
    

    Here is the sample output screenshot for reference:

    enter image description here