If you want to get all private IP addresses of a VM, try the PS command below:
$vm = get-azvm -VMName <vm name> -ResourceGroupName <resource Group name>
#get network interface information of vm
$nicRes = Get-AzResource -ResourceId $vm.NetworkProfile.NetworkInterfaces.Id
#get network interface object
$nic = Get-AzNetworkInterface -name $nicRes.name -ResourceGroupName $nicRes.ResourceGroupName
#read ip configs of this network interface
foreach($ipConfig in $nic.IpConfigurations){
$ipConfig.PrivateIpAddress
}
My IP configs of NIC:
Result:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…