Hello @Mateen Baig ,
Below is the summary of our offline discussion on this issue:
We found that the 0.0.0.0/0 route in your UDR was showing Invalid with next hop type "Null". So, I requested you to select the Next hop type as NVA. If that doesn't work, delete & recreate the route to make sure it is created correctly.
Also, if you want to add a route on your GatewaySubnet which says traffic to all your spoke subnets should go via NVA then a broader address prefix of your Vnet should work, unless there is another route which is more specific than UDR route somewhere because Azure always selects a route based on LPM (Longest Prefix Match) algorithm.
https://learn.microsoft.com/en-us/azure/virtual-network/virtual-networks-udr-overview#how-azure-selects-a-route
Azure always selects a route using LPM (Longest Prefix Match) algorithm. UDR gets preference when there are 2 similar routes.
Example: If a route table has two routes as below:
10. 0.0.0/24 address prefix -> default route
10. 0.0.0/16 address prefix -> UDR
Traffic destined for 10.0.0.5 will select the route with the next hop type specified in the route with the 10.0.0.0/24 address prefix (default route and not UDR), because 10.0.0.0/24 is a longer prefix than 10.0.0.0/16, even though 10.0.0.5 is within both address prefixes.
Similarly, if a route table has two routes as below:
0. 0.0.0/0 address prefix -> UDR
0. 0.0.0/0 address prefix -> default route
Any traffic destined outside the subnet will prefer UDR as both UDR and default route have same address prefix and there is no LPM.
So, the route priority in Azure is as below:
LPM > UDR > BGP route > system route
Kindly let us know if the above helps or you need further assistance on this issue.
----------------------------------------------------------------------------------------------------------------
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.