kumar
kumar

Reputation: 9387

Get location for Azure VM classic using powershell

Using powershell how do I get the location of a VM classic using powershell. Get-AzureVM does not seem to have this information

Upvotes: 0

Views: 328

Answers (1)

Tom Sun
Tom Sun

Reputation: 24549

We couldn't get the Azure VM location from the Get-AzureVM directly, but we could get it from the VM disk.Please have try to use the following code.

$serviceName = "xxxx"
$vmName ="xxxx"
$vm= Get-AzureVM -ServiceName $serviceName -Name $vmName 
$disk =  Get-AzureDisk -DiskName  $vm.VM.OSVirtualHardDisk.DiskName
$location = $disk.Location

enter image description here

Upvotes: 1

Related Questions