Freigeben über


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.

Comments

  • Anonymous
    November 18, 2016
    Any insight as to why the REST API version 2015-05-30-preview stopped sending this property back in the response? We've been using it for some time, then recently, it's gone.
    • Anonymous
      November 22, 2016
      This property was introduced in API version 2015-06-15. There was a bug that might have allowed clients with earlier API version to see this property. Bug was fixed recently.