Share via


How to get all Azure VM's Operating System information from My Azure Subscription. Like operation System Name and Version.and Build number

Question

Tuesday, March 5, 2019 5:25 PM

How to get all Azure VM's Operating System information from My Azure Subscription. Like operation System Name and Version.and Build number. 

Exmaple :- Windows 10.0.1080 and Ubuntu 18.04.2.

I Tried Inventory Service, I didn't get the complete details.

I tried the Power shell script :- 

https://stackoverflow.com/questions/51713858/azure-vm-os-build-powershell

It give some details but only for Windows Os.

Is there any service in Azure by using that I can pull the details mentioned above.

Thanks,

Mandava Babu.

All replies (5)

Tuesday, March 5, 2019 6:35 PM

You will have to create a custom script that would query the VMs and return the data. There seems to be no available API or service from Azure that provides this data.  Here is one reference script I found, see if that’s helpful: https://gallery.technet.microsoft.com/scriptcenter/How-to-retrieve-Azure-5a3d3751

You can also try if this helps get you the information you need:

VM=Get-AzureRMVM –Name VM1 –ResourceGroupName Rg1

$VM.StorageProfile.ImageReference property provides details like Publisher, Offer, Sku and Version.


Wednesday, March 6, 2019 8:28 AM | 1 vote

Hi Mandava,

You could either use PowerShell or CLI for this.

Azure PowerShell:

$AzureVMs = Get-AzureRmVM
$AzureVMs.StorageProfile.ImageReference

Azure CLI:

az vm list --query '[].{ Name:name, offer:storageProfile.imageReference.offer, publisher:storageProfile.imageReference.publisher, sku:storageProfile.imageReference.sku, version:storageProfile.imageReference.version}'

Cheers, Gourav Please remember to mark the replies as answers if it helped.


Wednesday, March 6, 2019 9:52 PM

Any update? Did any of the suggestions provided above help?

Karishma Tiwari - MSFT


Friday, March 22, 2019 7:59 PM

Any update on this issue? If the answer helped you resolve the problem remember to mark as answer so others in the community can easily find the solution


Thursday, September 12, 2019 2:30 PM

az vm list --query '[].{ Name:name, offer:storageProfile.imageReference.offer, publisher:storageProfile.imageReference.publisher, sku:storageProfile.imageReference.sku, version:storageProfile.imageReference.version}'

The above CLI script works nicely if the VM is not deallocated. Excellent!