@JoelP Thank you for reaching out. I understand you wish to know if a custom subnet route can override the route table setup via the gateway subnet. The answer is yes, as documented here.
- When outbound traffic is sent from a subnet, Azure selects a route based on the destination IP address, using the longest prefix match algorithm. For example, a route table has two routes: One route specifies the 10.0.0.0/24 address prefix, while the other route specifies the 10.0.0.0/16 address prefix. Azure directs traffic destined for 10.0.0.5 to the next hop type specified in the route with the 10.0.0.0/24 address prefix. This process occurs because 10.0.0.0/24 is a longer prefix than 10.0.0.0/16, even though 10.0.0.5 falls within both address prefixes. As your subnet route will be more specific. That one will be selected.
- If multiple routes contain the same address prefix, Azure selects the route type, based on the following priority (As for Express route BGP is used for custom routes)
- User-defined route
- BGP route