Moving to Azure Series – How to get the Azure VM Unique ID

On this series, I want to explore all the situations that you might encounter when you are moving your workloads to the cloud, specially to Azure.

On this post I will cover how to get the Unique ID from an Azure VM. Why is that important? When you migrate your workload from on premise to Azure, in some occasions the license of your application is attached to the server. Usually the COTS application is using either the Unique ID of the VM or other method to guarantee that the license is not used on other places.

This Unique ID is an identifier that can be used in several scenarios whether the VM is running on Azure or even on premise. This Unique ID cannot be modified, it can only be query using WMI Objects. Azure VM Unique ID it will never change, even if you reboot, shutdown, stopped and start, being serviced or even if you restore. Although if you use the snapshot to create a new VM or instance, then the VM Unique ID will change. This feature is enabled natively since September 2014. If your workload doesn’t have a Unique ID, just restart you VM and you should get the Unique ID.

Here is how you can query the Unique ID

For Windows VM use the following commands:

$computerSystemProduct = Get-WmiObject -class Win32_ComputerSystemProduct -namespace root\CIMV2

‘BIOS GUID:             “{0}”‘ -f $computerSystemProduct.UUID

For Linux VM use the following commands:

sudo dmidecode | grep UUID


Marcos Nogueira
Azure MVP
Twitter: @mdnoga

Marcos Nogueira

With more than 18 years experience in Datacenter Architectures, Marcos Nogueira is currently working as a Principal Cloud Solution Architect. He is an expert in Private and Hybrid Cloud, with a focus on Microsoft Azure, Virtualization and System Center. He has worked in several industries, including Aerospace, Transportation, Energy, Manufacturing, Financial Services, Government, Health Care, Telecoms, IT Services, and Gas & Oil in different countries and continents. Marcos was a Canadian MVP in System Center Cloud & Datacenter Managenment and he has +14 years as Microsoft Certified, with more than 100+ certifications (MCT, MCSE, and MCITP, among others). Marcos is also certified in VMware, CompTIA and ITIL v3. He assisted Microsoft in the development of workshops and special events on Private & Hybrid Cloud, Azure, System Center, Windows Server, Hyper-V and as a speaker at several Microsoft TechEd/Ignite and communities events around the world.

Leave a Reply

Your email address will not be published. Required fields are marked *