Advertisement
guyrleech

Retrieve Azure virtual network peerings via AZ PowerShell module

Apr 4th, 2022
1,795
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ## retrieve Azure virtual network peerings via AZ PowerShell module to help find overlaps
  2.  
  3. Get-AzVirtualNetwork |ForEach-Object { $vnet = $_; Get-AzVirtualNetworkPeering -VirtualNetworkName $_.Name -ResourceGroupName $_.ResourceGroupName | select @{n='ResourceGroup';e={$vnet.ResourceGroupName}},Name,VirtualNetworkName,@{n='AddressPrefixes';e={$vnet.AddressSpace.AddressPrefixes}},@{n='Subnets';e={$vnet.Subnets|Select -expand AddressPrefix}},@{n='PeeringTo';e={$_.RemoteVirtualNetworkAddressSpace | Select -expand AddressPrefixes }} }| sort-object -Property PeeringTo | format-table -auto
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement