Reputation: 9387
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
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
Upvotes: 1