Hi @Peter Stieber,
Thank you for reaching out on Microsoft Q&A forum.
I understand you want to know if it’s possible to retrieve effective routes for an ExpressRoute gateway deployed in a Virtual Hub using an API.
Yes — Azure provides a public REST API called GetEffectiveVirtualHubRoutes, which allows you to query the effective routes for specific resources inside a Virtual Hub, including an ExpressRoute connection. This API returns the actual computed routes that the Virtual WAN fabric applies, combining both your configured static routes and dynamically learned routes via BGP. It’s useful for verifying routing behaviour, troubleshooting connectivity, and validating route propagation in complex hybrid environments.
To use this API for an ExpressRoute connection, you submit a POST request to the effectiveRoutes endpoint of your Virtual Hub, specifying the resource ID of your ExpressRoute connection and the resource type (ExpressRouteConnection).
Example request:
POST https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualHubs/virtualHub1/effectiveRoutes?api-version=2024-05-01
{
"resourceId": "/subscriptions/subid/resourceGroups/resourceGroupName/providers/Microsoft.Network/expressRouteGateways/expressRouteGatewayName/expressRouteConnections/connectionName",
"virtualWanResourceType": "ExpressRouteConnection"
}
The response will include details such as:
- Route prefixes (e.g., 10.10.0.0/16)
- Next hop IPs
- AS paths for BGP-learned routes
- Route sources (e.g., Static, BGP)
- Propagated route table and policy details
Reference: Get Effective Virtual Hub Routes – REST API
Kindly let us know if you have any additional questions.
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.