Listing all azure vm belonging to particular subnet
问题 I want to list all azure vms in a particular subnet. I don't know how to write a PowerShell script for this. I am trying the below but it's not giving the desired output. My desired output- All VMs belonging to subnet having ip 10.87.00.01...10.87.99.99 should get listed in my text file subnet_VM.txt $tgtIP = "10.87.xx.xx" $vms = Get-AzureVM foreach($vm in $vms) { $vmIP = (Get-AzureVM -ServiceName $vm.ServiceName –Name $vm.Name).IpAddress foreach($ip in $vmIP) { if($ip -like '$tgtIP*') { $vm