|
| 1 | +--- |
| 2 | +title: Configure routing preference - Azure CLI |
| 3 | +titleSuffix: Azure Route Server |
| 4 | +description: Learn how to configure routing preference (preview) in Azure Route Server using the Azure CLI to influence its route selection. |
| 5 | +author: halkazwini |
| 6 | +ms.author: halkazwini |
| 7 | +ms.service: route-server |
| 8 | +ms.topic: how-to |
| 9 | +ms.date: 10/12/2023 |
| 10 | +ms.custom: mode-api, devx-track-azurecli |
| 11 | + |
| 12 | +#CustomerIntent: As an Azure administrator, I want learn how to use routing preference setting so that I can influence route selection in Azure Route Server by using the Azure CLI. |
| 13 | +--- |
| 14 | + |
| 15 | +# Configure routing preference to influence route selection using the Azure CLI |
| 16 | + |
| 17 | +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)](hub-routing-preference.md). |
| 18 | + |
| 19 | +> [!IMPORTANT] |
| 20 | +> Routing preference is currently in PREVIEW. |
| 21 | +> See the [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/) for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability. |
| 22 | +
|
| 23 | +## Prerequisites |
| 24 | + |
| 25 | +- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). |
| 26 | +- An Azure route server. If you need to create a Route Server, see [Create and configure Azure Route Server](quickstart-configure-route-server-cli.md). |
| 27 | +- Azure Cloud Shell or Azure CLI installed locally. |
| 28 | + |
| 29 | +## View routing preference configuration |
| 30 | + |
| 31 | +Use [az network routeserver show](/cli/azure/network/routeserver#az-network-routeserver-show()) to view the current route server configuration including its routing preference setting. |
| 32 | + |
| 33 | +```azurecli-interactive |
| 34 | +# Show the Route Server configuration. |
| 35 | +az network routeserver show --resource-group 'myResourceGroup' --name 'myRouteServer' |
| 36 | +``` |
| 37 | + |
| 38 | +In the output, you can see the current routing preference setting in front of **"HubRoutingPreference":**: |
| 39 | + |
| 40 | +```output |
| 41 | +{ |
| 42 | + "allowBranchToBranchTraffic": false, |
| 43 | + "etag": "W/\"00000000-1111-2222-3333-444444444444\"", |
| 44 | + "hubRoutingPreference": "ExpressRoute", |
| 45 | + "id": "/subscriptions/abcdef01-2345-6789-0abc-def012345678/resourceGroups/myResourceGroup/providers/Microsoft.Network/virtualHubs/myRouteServer", |
| 46 | + "kind": "RouteServer", |
| 47 | + "location": "eastus", |
| 48 | + "name": "myRouteServer", |
| 49 | + "provisioningState": "Succeeded", |
| 50 | + "resourceGroup": "myResourceGroup", |
| 51 | + "routeTable": { |
| 52 | + "routes": [] |
| 53 | + }, |
| 54 | + "routingState": "Provisioned", |
| 55 | + "sku": "Standard", |
| 56 | + "tags": {}, |
| 57 | + "type": "Microsoft.Network/virtualHubs", |
| 58 | + "virtualHubRouteTableV2s": [], |
| 59 | + "virtualRouterAsn": 65515, |
| 60 | + "virtualRouterAutoScaleConfiguration": { |
| 61 | + "minCapacity": 2 |
| 62 | + }, |
| 63 | + "virtualRouterIps": [ |
| 64 | + "10.1.1.5", |
| 65 | + "10.1.1.4" |
| 66 | + ] |
| 67 | +} |
| 68 | +``` |
| 69 | + |
| 70 | +> [!NOTE] |
| 71 | +> The default routing preference setting is **ExpressRoute**. |
| 72 | +
|
| 73 | +## Configure routing preference |
| 74 | + |
| 75 | +Use [az network routeserver update](/cli/azure/network/routeserver#az-network-routeserver-update()) to update routing preference setting. |
| 76 | + |
| 77 | +```azurecli-interactive |
| 78 | +# Change the routing preference to AS Path. |
| 79 | +az network routeserver update --name 'myRouteServer' --resource-group 'myResourceGroup' --hub-routing-preference 'ASPath' |
| 80 | +``` |
| 81 | + |
| 82 | +```azurecli-interactive |
| 83 | +# Change the routing preference to VPN Gateway. |
| 84 | +az network routeserver update --name 'myRouteServer' --resource-group 'myResourceGroup' --hub-routing-preference 'VpnGateway' |
| 85 | +``` |
| 86 | + |
| 87 | +```azurecli-interactive |
| 88 | +# Change the routing preference to ExpressRoute. |
| 89 | +az network routeserver update --name 'myRouteServer' --resource-group 'myResourceGroup' --hub-routing-preference 'ExpressRoute' |
| 90 | +``` |
| 91 | + |
| 92 | +## Related content |
| 93 | + |
| 94 | +- [Create and configure Route Server](quickstart-configure-route-server-cli.md) |
| 95 | +- [Monitor Azure Route Server](monitor-route-server.md) |
| 96 | +- [Azure Route Server FAQ](route-server-faq.md) |
0 commit comments