Quickstart: Create an Azure Route Server using PowerShell

In this quickstart, you learn how to create an Azure Route Server to peer with a network virtual appliance (NVA) in your virtual network using Azure PowerShell.

Diagram of Route Server deployment environment using the Azure PowerShell.

Important

Azure Route Servers created before November 1, 2021, that don't have a public IP address associated, are deployed with the public preview offering. The public preview offering is not backed by General Availability SLA and support. To deploy Azure Route Server with the General Availability offering, and to achieve General Availability SLA and support, please delete and recreate your Route Server.

Prerequisites

Create a route server

In this section, you create a route server. Prior to creating the route server, create a resource group to host all resources including the route server. You'll also need to create a virtual network with a dedicated subnet for the route server.

  1. Create a resource group using New-AzResourceGroup cmdlet. The following example creates a resource group named RouteServerRG in the ChinaNorth3 region:

    # Create a resource group.
    New-AzResourceGroup = -Name 'RouteServerRG' -Location 'ChinaNorth3'
    
  2. The route server requires a dedicated subnet named RouteServerSubnet. The subnet size has to be at least /27 or shorter prefix (such as /26 or /25) or you'll receive an error message when deploying the route server. Create a subnet configuration for RouteServerSubnet using New-AzVirtualNetworkSubnetConfig cmdlet.

    # Create subnet configuration.
    $subnet = New-AzVirtualNetworkSubnetConfig -Name 'RouteServerSubnet' -AddressPrefix '10.0.1.0/27'
    
  3. Create a virtual network using New-AzVirtualNetwork cmdlet. The following example creates a default virtual network named myRouteServerVNet in the ChinaNorth3 region.

    # Create a virtual network and place into a variable.
    $vnet = New-AzVirtualNetwork -Name 'myRouteServerVNet' -ResourceGroupName 'RouteServerRG' -Location 'ChinaNorth3' -AddressPrefix '10.0.0.0/16' -Subnet $subnet
    # Place the subnet ID into a variable.
    $subnetId = (Get-AzVirtualNetworkSubnetConfig -Name 'RouteServerSubnet' -VirtualNetwork $vnet).Id
    
  4. To ensure connectivity to the backend service that manages Route Server configuration, assigning a public IP address is required. Create a Standard Public IP named RouteServerIP using New-AzPublicIpAddress cmdlet.

    # Create a Standard public IP and place it into a variable.
    $publicIp = New-AzPublicIpAddress -ResourceGroupName 'RouteServerRG' -Name 'myRouteServerIP' -Location 'ChinaNorth3' -AllocationMethod 'Static' -Sku 'Standard' -IpAddressVersion 'Ipv4'
    
  5. Create the route server using New-AzRouteServer cmdlet. The following example creates a route server named myRouteServer in the ChinaNorth3 region. The HostedSubnet is the resource ID of the RouteServerSubnet created in the previous steps.

    # Create the route server.
    New-AzRouteServer -RouteServerName 'myRouteServer' -ResourceGroupName 'RouteServerRG' -Location 'ChinaNorth3' -HostedSubnet $subnetId -PublicIP $publicIp
    

    Note

    The deployment of the Route Server can take up to 30 minutes.

Set up peering with NVA

In this section, you learn how to configure BGP peering with a network virtual appliance (NVA). Use Add-AzRouteServerPeer cmdlet to establish BGP peering from the route server to your NVA. The following example adds a peer named myNVA that has an IP address of 10.0.0.4 and an ASN of 65001. For more information, see What Autonomous System Numbers (ASNs) can I use?

# Add a peer.
Add-AzRouteServerPeer -ResourceGroupName 'RouteServerRG' -RouteServerName 'myRouteServer' -PeerName 'myNVA' -PeerAsn '65001' -PeerIp '10.0.0.4'

Complete the configuration on the NVA

To complete the peering setup, you must configure the NVA to establish a BGP session with the route server's peer IPs and ASN. Use Get-AzRouteServer cmdlet to get the IP and ASN of the route server.

# Get the route server details.
Get-AzRouteServer -ResourceGroupName 'RouteServerRG' -RouteServerName 'myRouteServer'

The output should look similar to the following example:

ResourceGroupName Name          Location RouteServerAsn RouteServerIps       ProvisioningState HubRoutingPreference AllowBranchToBranchTraffic
----------------- ----          -------- -------------- --------------       ----------------- -------------------- --------------------------
RouteServerRG     myRouteServer chinanorth3   65515          {10.0.1.4, 10.0.1.5} Succeeded         ExpressRoute         False

Important

We recommend peering each NVA with both route server instances to ensure that virtual network routes are advertised over the NVA connections and achieve high availability.

Clean up resources

When no longer needed, delete the resource group and all of the resources it contains using Remove-AzResourceGroup cmdlet.

# Delete the resource group and all the resources it contains. 
Remove-AzResourceGroup -Name 'RouteServerRG' -Force

Next step