Azure Virtual Machine Unique ID

As many organisations are moving their workload to the Azure, It is important for an organisation to keep track of their Azure IaaS deployments. Azure provides support to identify each virtual machine with a unique identifier. This VM identifier can be used for licensing, reporting or general tracking purpose for Azure IaaS deployments. This unique identifier can’t be modified and can only be queried.

If you want to take advantage of this capability, you can access VM unique Identifier for Azure Virtual Machine using Azure Resource Explorer as follows.

Step 1 – Access and log in to the Azure Resource Explorer @ https://resources.azure.com

Step 2 – Navigate to your Windows or Linux virtual machine.

Step 3 – Click on name of virtual machine and you will find all properties of the virtual machine on right side including VM unique identifier VmId.

Azure VmId for Windows

Here is the PowerShell script to get virtual machine VmId.

$vm = Get-AzureRmVM -ResourceGroupName 'rg' -Name 'vm' $vmResource = Get-AzureRmResource -ResourceName $vm.Name -ResourceGroupName $vm.ResourceGroupName -ResourceType 'Microsoft.Compute/virtualMachines' $vmId = $vmResource.Properties.VmId Write-Output $vmId

It is important to note that all the virtual machines which are created before September/2014 will get VmId upon restart.