Last active
May 5, 2022 02:19
-
-
Save dmauser/d22bca203669db7226a5dea7c69ea9ea to your computer and use it in GitHub Desktop.
Dump effective routes of all vWAN Hubs route tables (AZCLI)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#vHUB effective routes | |
#parameters | |
rg=vwan-pair #Set your resource group | |
#variables (do not change) | |
#Parameter | |
$rg=vwan-pair | |
# Dump all vHUB route tables. | |
for vhubname in `az network vhub list -g $rg --query "[].id" -o tsv | rev | cut -d'/' -f1 | rev` | |
do | |
for routetable in `az network vhub route-table list --vhub-name $vhubname -g $rg --query "[].id" -o tsv` | |
do | |
if [ "$(echo $routetable | rev | cut -d'/' -f1 | rev)" != "noneRouteTable" ]; then | |
echo -e vHUB: $vhubname | |
echo -e Effective route table: $(echo $routetable | rev | cut -d'/' -f1 | rev) | |
az network vhub get-effective-routes -g $rg -n $vhubname \ | |
--resource-type RouteTable \ | |
--resource-id $routetable \ | |
--query "value[].{addressPrefixes:addressPrefixes[0], asPath:asPath, nextHopType:nextHopType}" \ | |
--output table | |
echo | |
fi | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment