All scripts
Azure AI 923

Get-AzureVNetPeeringReport

Maps every virtual network peering connection in the subscription and its state, so a broken or misconfigured peering does not go unnoticed until connectivity fails.

Get-AzureVNetPeeringReport.ps1
<#
.SYNOPSIS
    Reports virtual network peering connections and their state.

.DESCRIPTION
    Lists every VNet peering connection across the subscription with its
    connection state and whether traffic forwarding is allowed, so a
    broken or misconfigured peering is caught before it causes a
    connectivity incident.

.EXAMPLE
    .\Get-AzureVNetPeeringReport.ps1

.NOTES
    Requires the Az.Network module and an active Connect-AzAccount session.

.AUTHOR
    Shehryar Hassan
#>

$vnets = Get-AzVirtualNetwork

$report = foreach ($vnet in $vnets) {
    foreach ($peering in $vnet.VirtualNetworkPeerings) {
        [pscustomobject]@{
            VNet             = $vnet.Name
            PeeringName      = $peering.Name
            RemoteVNet       = ($peering.RemoteVirtualNetwork.Id -split "/")[-1]
            State            = $peering.PeeringState
            AllowForwarding  = $peering.AllowForwardedTraffic
        }
    }
}

$report | Format-Table -AutoSize
$report | Where-Object { $_.State -ne "Connected" } | ForEach-Object { Write-Warning "$($_.VNet) -> $($_.RemoteVNet) is in state: $($_.State)" }

Read it before you run it, and test in a safe tenant first.