The kusto query below will give you a list of all manually added routes/UDRs in all of your Route Tables(RT) in all subnets in all subscriptions. (Where you have access).
This is a great way to keep track of your UDRs…lest they get out of hand…
You will get the following info from each UDR:
Resource Group Name
Next Hop Type
Next Hop IP Address
Has BGP Override
In my current Azure network, the total UDR count is around 413, in 39 different RTs. Its not easy to keep track and t-shoot the network, not easy at all.
Use different sort or where clauses to filter and sort on what you are currently looking for, if you for example filter on
| where addressPrefix == ‘0.0.0.0/0’
you will see only the routes for ‘unrouted’ traffic.
| where nextHopType == ‘VirtualAppliance’
will list all routes to your(?) Virtual appliance Firewall, and so on.
(You can add the where clauses at the end below the last line)
resources | where type =~ "Microsoft.Network/routeTables" | mv-expand rules = properties.routes | join kind=leftouter (resourcecontainers | where type=='microsoft.resources/subscriptions' | project SubcriptionName=name, subscriptionId) on subscriptionId | extend subnet_name = split((split(tostring(properties.subnets), '/')), '"') | extend addressPrefix = tostring(rules.properties.addressPrefix) | extend nextHopType = tostring(rules.properties.nextHopType) | extend nextHopIpAddress = tostring(rules.properties.nextHopIpAddress) | extend hasBgpOverride = tostring(rules.properties.hasBgpOverride) | extend provisioningState = tostring(rules.properties.provisioningState) | extend udrname = rules.name | extend rtname = name | project SubcriptionName, resourceGroup, subnet_name, rtname, udrname, addressPrefix, nextHopType, nextHopIpAddress, provisioningState, hasBgpOverride | sort by SubcriptionName, resourceGroup asc, rtname asc, addressPrefix asc