Quickstart: Create an Azure Route Server using an ARM template

This quickstart describes how to use an Azure Resource Manager template (ARM template) to deploy an Azure Route Server into a new or existing virtual network.

An ARM template is a JavaScript Object Notation (JSON) file that defines the infrastructure and configuration for your project. The template uses declarative syntax. In declarative syntax, you describe your intended deployment without writing the sequence of programming commands to create the deployment.

If your environment meets the prerequisites and you're familiar with using ARM templates, select the Deploy to Azure button. The template will open in the Azure portal.

Deploy to Azure

Prerequisites

If you don't have an Azure subscription, create a free account before you begin.

Review the template

The template used in this quickstart is from Azure Quickstart Templates.

In this quickstart, you'll deploy an Azure Route Server into a new or existing virtual network. A dedicated subnet named RouteServerSubnet will be created to host the Route Server. The Route Server will also be configured with the Peer ASN and Peer IP to establish a BGP peering.

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "vnetName": {
      "type": "string",
      "defaultValue": "routeservervnet",
      "metadata": {
        "description": "Name of new or existing vnet to which Azure Route Server should be deployed."
      }
    },
    "vnetIpPrefix": {
      "type": "string",
      "defaultValue": "10.1.0.0/16",
      "metadata": {
          "description": "IP prefix for available addresses in vnet address space."
      }
    },
    "vnetNew-or-Existing": {
        "type": "string",
        "allowedValues": [
            "New",
            "Existing"
        ],
        "defaultValue": "New",
        "metadata": {
            "description": "Specify whether to provision new vnet or deploy to existing vnet."
        }
    },
    "routeServerSubnetIpPrefix": {
      "type": "string",
      "defaultValue": "10.1.1.0/27",
      "metadata": {
          "description": "Route Server subnet IP prefix MUST be within vnet IP prefix address space."
      }
    },
    "firstRouteServerName": {
      "type": "string",
      "defaultValue": "routeserver",
      "metadata": {
        "description": "Name of Route Server."
      }
    },
    "routeServerBgpConnectionName": {
      "type": "string",
      "defaultValue": "conn1",
      "metadata": {
        "description": "Name of BGP connection."
      }
    },
    "peerAsn": {
      "type": "string",
      "defaultValue": "65002",
      "metadata": {
        "description": "Peer ASN connecting to."
      }
    },
    "peerIp": {
      "type": "string",
      "defaultValue": "10.0.1.4",
      "metadata": {
        "description": "Peer IP connecting to."
      }
    },
    "location": {
      "type": "string",
      "defaultValue": "[resourceGroup().location]",
      "metadata": {
        "description": "Azure region for Route Server and virtual network."
      }
    }    
  },
  "variables": {    
    "ipconfigName": "[concat(parameters('firstRouteServerName'), '/ipconfig1')]",
    "bgpConnectionName": "[concat(parameters('firstRouteServerName'), '/', parameters('routeServerBgpConnectionName'))]",
    "routeserver-subnet-name": "RouteServerSubnet"
  },
  "resources": [
    {
      "condition": "[equals(parameters('vnetNew-or-Existing'), 'New')]",
      "apiVersion": "2020-05-01",
      "name": "[parameters('vnetName')]",
      "type": "Microsoft.Network/virtualNetworks",
      "location": "[parameters('location')]",
       "properties": {
           "addressSpace": {
               "addressPrefixes": [
                  "[parameters('vnetIpPrefix')]"
                ]
            }
        }
    },
    {
      "type": "Microsoft.Network/virtualNetworks/subnets",
      "apiVersion": "2020-05-01",
      "name": "[concat(parameters('vnetName'), '/', variables('routeserver-subnet-name'))]",
      "location": "[parameters('location')]",
      "dependsOn": [
          "[resourceId('Microsoft.Network/virtualNetworks', parameters('vnetName'))]"
      ],
      "properties": {
          "addressPrefix": "[parameters('routeServerSubnetIpPrefix')]"
      }
    },
    {
      "type": "Microsoft.Network/virtualHubs",
      "apiVersion": "2020-06-01",
      "name": "[parameters('firstRouteServerName')]",
      "location": "[parameters('location')]",
      "dependsOn": [
          "[resourceId('Microsoft.Network/virtualNetworks', parameters('vnetName'))]",
          "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), variables('routeserver-subnet-name'))]"
      ],
      "properties": {
        "sku": "Standard"
      }
    },
    {
      "type": "Microsoft.Network/virtualHubs/ipConfigurations",
      "apiVersion": "2020-06-01",
      "name": "[variables('ipconfigName')]",
      "dependsOn": [
        "[resourceId('Microsoft.Network/virtualHubs', parameters('firstRouteServerName'))]"
      ],
      "properties": {
        "subnet": {
          "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), variables('routeserver-subnet-name'))]"
        }
      }
    },
    {
      "type": "Microsoft.Network/virtualHubs/bgpConnections",
      "apiVersion": "2020-06-01",
      "name": "[variables('bgpConnectionName')]",
      "dependsOn": [
        "[resourceId('Microsoft.Network/virtualHubs/ipConfigurations', parameters('firstRouteServerName'), 'ipconfig1')]"
      ],
      "properties": {
        "peerAsn": "[parameters('peerAsn')]",
        "peerIp": "[parameters('peerIp')]"
      }
    }   
  ],
  "outputs": {}
}

Multiple Azure resources have been defined in the template:

To find more templates that are related to ExpressRoute, see Azure Quickstart Templates.

Deploy the template

  1. Select Try it from the following code block to open Azure Cloud Shell, and then follow the instructions to sign in to Azure.

    $projectName = Read-Host -Prompt "Enter a project name that is used for generating resource names"
    $location = Read-Host -Prompt "Enter the location (i.e. centralus)"
    $templateUri = "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/quickstarts/microsoft.network/route-server/azuredeploy.json"
    
    $resourceGroupName = "${projectName}rg"
    
    New-AzResourceGroup -Name $resourceGroupName -Location "$location"
    New-AzResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateUri $templateUri
    
    Read-Host -Prompt "Press [ENTER] to continue ..."
    

    Wait until you see the prompt from the console.

  2. Select Copy from the previous code block to copy the PowerShell script.

  3. Right-click the shell console pane and then select Paste.

  4. Enter the values.

    The resource group name is the project name with rg appended.

    It takes about 20 minutes to deploy the template. When completed, the output is similar to:

    Route Server Resource Manager template PowerShell deployment output.

Azure PowerShell is used to deploy the template. In addition to Azure PowerShell, you can also use the Azure portal, Azure CLI, and REST API. To learn other deployment methods, see Deploy templates.

Validate the deployment

  1. Sign in to the Azure portal.

  2. Select Resource groups from the left pane.

  3. Select the resource group that you created in the previous section. The default resource group name is the project name with rg appended.

  4. The resource group should contain only the virtual network:

    Route Server deployment resource group with virtual network.

  5. Go to https://aka.ms/routeserver.

  6. Select the Route Server named routeserver to verify that the deployment was successful.

    Screenshot of Route Server overview page.

Clean up resources

When you no longer need the resources that you created with the Route Server, delete the resource group. This removes the Route Server and all the related resources.

To delete the resource group, call the Remove-AzResourceGroup cmdlet:

Remove-AzResourceGroup -Name <your resource group name>

Next steps

In this quickstart, you created a:

  • Route Server
  • Virtual Network
  • Subnet

After you create the Azure Route Server, continue to learn about how Azure Route Server interacts with ExpressRoute and VPN Gateways: