Uniquely Identify an Azure VM Even after Deprovisioning

If a VM is deprovisioned in Azure, when it is reprovisioned it will get a new GUID, making it hard to track VMs through management applications.

John Savill

August 11, 2015

1 Min Read
Uniquely Identify an Azure VM Even after Deprovisioning

Q. How can I uniquely identify an Azure VM, even if it's deprovisioned then reprovisioned?

A. If a VM is deprovisioned in Azure, when it is reprovisioned it will get a new GUID, making it hard to track VMs through management applications. To help solve this, Azure gives each VM a unique ID that can be queried from inside the VM using the code below:

$computerSystemProduct = Get-WmiObject -class Win32_ComputerSystemProduct -namespace rootCIMV2
'VM UUID is "{0}"' -f $computerSystemProduct.UUID

This value is stored in the Azure VMs SMBIOS and is durable even if the VM is deallocated then reallocated to the Azure fabric. Note that if you delete the VM then create a new VM using the existing VHDs, then the VM UUID will be reset to a new value.

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like