Rediger

Del via


Quickstart: Create an Azure Route Server using an ARM template

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

An Azure Resource Manager template is a JavaScript Object Notation (JSON) file that defines the infrastructure and configuration for your project. The template uses 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 to open the template in the Azure portal.

Button to deploy the Resource Manager template to Azure.

Prerequisites

Review the template

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

Using this template, you deploy an Azure Route Server into a new or existing virtual network. A dedicated subnet named RouteServerSubnet is 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",
  "metadata": {
    "_generator": {
      "name": "bicep",
      "version": "0.5.6.12127",
      "templateHash": "3572840517141664306"
    }
  },
  "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",
      "defaultValue": "New",
      "allowedValues": [
        "New",
        "Existing"
      ],
      "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."
      }
    },
    "publicIpNew_or_Existing": {
      "type": "string",
      "defaultValue": "New",
      "allowedValues": [
        "New",
        "Existing"
      ],
      "metadata": {
        "description": "Specify whether to provision new standard public IP or deploy using existing standard public IP."
      }
    },
    "publicIpName": {
      "type": "string",
      "defaultValue": "routeserverpip",
      "metadata": {
        "description": "Name of the standard Public IP used for the Route Server"
      }
    },
    "firstRouteServerName": {
      "type": "string",
      "defaultValue": "routeserver",
      "metadata": {
        "description": "Name of Route Server."
      }
    },
    "routeServerBgpConnectionName": {
      "type": "string",
      "defaultValue": "conn1",
      "metadata": {
        "description": "Name of BGP connection."
      }
    },
    "peerAsn": {
      "type": "int",
      "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": "ipconfig1",
    "routeServerSubnetName": "RouteServerSubnet"
  },
  "resources": [
    {
      "condition": "[equals(parameters('vnetNew_or_Existing'), 'New')]",
      "type": "Microsoft.Network/virtualNetworks",
      "apiVersion": "2020-05-01",
      "name": "[parameters('vnetName')]",
      "location": "[parameters('location')]",
      "properties": {
        "addressSpace": {
          "addressPrefixes": [
            "[parameters('vnetIpPrefix')]"
          ]
        }
      }
    },
    {
      "type": "Microsoft.Network/virtualNetworks/subnets",
      "apiVersion": "2020-05-01",
      "name": "[format('{0}/{1}', parameters('vnetName'), variables('routeServerSubnetName'))]",
      "properties": {
        "addressPrefix": "[parameters('routeServerSubnetIpPrefix')]"
      },
      "dependsOn": [
        "[resourceId('Microsoft.Network/virtualNetworks', parameters('vnetName'))]"
      ]
    },
    {
      "condition": "[equals(parameters('publicIpNew_or_Existing'), 'New')]",
      "type": "Microsoft.Network/publicIPAddresses",
      "apiVersion": "2020-05-01",
      "name": "[parameters('publicIpName')]",
      "location": "[parameters('location')]",
      "sku": {
        "name": "Standard"
      },
      "properties": {
        "publicIPAllocationMethod": "Static",
        "publicIPAddressVersion": "IPv4",
        "idleTimeoutInMinutes": 4
      }
    },
    {
      "type": "Microsoft.Network/virtualHubs",
      "apiVersion": "2020-06-01",
      "name": "[parameters('firstRouteServerName')]",
      "location": "[parameters('location')]",
      "properties": {
        "sku": "Standard"
      }
    },
    {
      "type": "Microsoft.Network/virtualHubs/ipConfigurations",
      "apiVersion": "2020-06-01",
      "name": "[format('{0}/{1}', parameters('firstRouteServerName'), variables('ipconfigName'))]",
      "properties": {
        "subnet": {
          "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), variables('routeServerSubnetName'))]"
        },
        "publicIPAddress": {
          "id": "[resourceId('Microsoft.Network/publicIPAddresses', parameters('publicIpName'))]"
        }
      },
      "dependsOn": [
        "[resourceId('Microsoft.Network/virtualHubs', parameters('firstRouteServerName'))]",
        "[resourceId('Microsoft.Network/publicIPAddresses', parameters('publicIpName'))]",
        "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), variables('routeServerSubnetName'))]"
      ]
    },
    {
      "type": "Microsoft.Network/virtualHubs/bgpConnections",
      "apiVersion": "2020-06-01",
      "name": "[format('{0}/{1}', parameters('firstRouteServerName'), parameters('routeServerBgpConnectionName'))]",
      "properties": {
        "peerAsn": "[parameters('peerAsn')]",
        "peerIp": "[parameters('peerIp')]"
      },
      "dependsOn": [
        "[resourceId('Microsoft.Network/virtualHubs', parameters('firstRouteServerName'))]",
        "[resourceId('Microsoft.Network/virtualHubs/ipConfigurations', parameters('firstRouteServerName'), variables('ipconfigName'))]"
      ]
    }
  ]
}

Multiple Azure resources have been defined in the template:

To find more templates, see Azure Quickstart Templates.

Deploy the template

  1. Select Open Cloudshell 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 to remove the Route Server and all the related resources.

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

Remove-AzResourceGroup -Name <your resource group name>

Next step