[System.Collections.Generic.List[PSObject]] $IPAddresses = @()
$VMs = Get-AzureRMVM
foreach($VM in $VMs){
foreach($interface in $VM.NetworkProfile.NetworkInterfaces){
$resource = Get-AzureRMResource -id $interface.Id
$nic = Get-AzureRmNetworkInterface -Name $resource.Name -ResourceGroupName $resource.ResourceGroupName
Get-AzureRmNetworkInterfaceIpConfig -NetworkInterface $nic | Select-Object @{l='VM';e={$VM.Name}}, PrivateIpAddress, PrivateIpAllocationMethod |
ForEach-Object{ $IPAddresses.Add($_) }
}
}
$IPAddresses
This snippet will get all virtual machines in your Azure subscription, then return the internal IP Adresses