Skip to content

Instantly share code, notes, and snippets.

@dmauser
Last active May 5, 2022 02:19
Show Gist options
  • Save dmauser/d22bca203669db7226a5dea7c69ea9ea to your computer and use it in GitHub Desktop.
Save dmauser/d22bca203669db7226a5dea7c69ea9ea to your computer and use it in GitHub Desktop.
Dump effective routes of all vWAN Hubs route tables (AZCLI)
#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