Configure routing preference to influence route selection using PowerShell

Learn how to use routing preference setting in Azure Route Server to influence its route learning and selection. For more information, see Routing preference (Preview).

Important

Routing preference is currently in PREVIEW. See the Supplemental Terms of Use for Microsoft Azure Previews for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability.

Prerequisites

View routing preference configuration

Use Get-AzRouteServer to view the current routing preference configuration.

# Get the Route Server.
Get-AzRouteServer -ResourceGroupName 'myResourceGroup'

In the output, you can see the current routing preference setting under HubRoutingPreference:

ResourceGroupName Name          Location RouteServerAsn RouteServerIps       ProvisioningState HubRoutingPreference
----------------- ----          -------- -------------- --------------       ----------------- --------------------
myResourceGroup   myRouteServer eastus   65515          {10.1.1.5, 10.1.1.4} Succeeded         ExpressRoute

Note

The default routing preference setting is ExpressRoute.

Configure routing preference

Use Update-AzRouteServer to configure routing preference.

# Change the routing preference to AS Path.
Update-AzRouteServer -RouteServerName 'myRouteServer' -HubRoutingPreference 'ASPath' -ResourceGroupName 'myResourceGroup'
# Change the routing preference to VPN Gateway.
Update-AzRouteServer -RouteServerName 'myRouteServer' -HubRoutingPreference 'VpnGateway' -ResourceGroupName 'myResourceGroup'
# Change the routing preference to ExpressRoute.
Update-AzRouteServer -RouteServerName 'myRouteServer' -HubRoutingPreference 'ExpressRoute' -ResourceGroupName 'myResourceGroup'

Important

Include -AllowBranchToBranchTraffic parameter to enable route exchange (branch-to-branch) even if it was enabled before running the Update-AzRouteServer cmdlet. For more information, see Configure route exchange.