Connect-AzureAd
$array = @()
$ipranges = Get-AzureADMSNamedLocationPolicy | select displayname,ipranges
foreach($range in $ipranges)
{
write-host "Found" $range.displayname
write-host "IP Range" ($range).ipranges.cidraddress
$item = New-Object PSObject
$item | Add-Member -type NoteProperty -Name 'Display Name' -Value ($range).displayname
$item | Add-Member -type NoteProperty -Name 'IP Range' -Value ($range).ipranges.cidraddress
$array += $item
}
$array | Out-GridView