Introduction to Azure ExpressRoute

Azure ExpressRoute is a service that allows you to create a dedicated private connection between your on-premises infrastructure and Azure datacenters. ExpressRoute provides a more reliable and consistent network experience than a standard internet-based connection, with lower latency and higher bandwidths.

This tutorial will guide you through the process of setting up Azure ExpressRoute using the Azure CLI. The Azure CLI is a command-line interface for interacting with Azure resources, and it can be used to create and manage Azure ExpressRoute circuits and connections.

Prerequisites

Before you begin, you will need:

  • An Azure subscription
  • An Azure virtual network and a virtual network gateway
  • A supported device or service provider that can connect to Azure ExpressRoute

Step 1: Install the Azure CLI

If you haven’t already installed the Azure CLI, you can do so by following the instructions in the Azure CLI documentation.

Step 2: Create an ExpressRoute circuit

To create an ExpressRoute circuit, use the az network express-route circuit create command. This command creates a new circuit with the specified parameters.

The following example command creates an ExpressRoute circuit named “myExpressRouteCircuit” in the resource group named “myResourceGroup” and the location “East US”.

az network express-route circuit create \
  --name myExpressRouteCircuit \
  --resource-group myResourceGroup \
  --location eastus \
  --sku-tier Standard \
  --sku-family MeteredData \
  --bandwidth-in-mbps 100 \
  --peerings MicrosoftPeering

In this command:

  • --name specifies the name of the circuit.
  • --resource-group specifies the name of the resource group in which to create the circuit.
  • --location specifies the location in which to create the circuit.
  • --sku-tier specifies the tier of the ExpressRoute circuit. The available values are Standard and Premium.
  • --sku-family specifies the billing model for the ExpressRoute circuit. The available values are UnlimitedData and MeteredData.
  • --bandwidth-in-mbps specifies the bandwidth of the circuit in megabits per second (Mbps).
  • --peerings specifies the type of peering to create. The available values are MicrosoftPeering, AzurePrivatePeering, and AzurePublicPeering.

Step 3: Create an ExpressRoute circuit connection

To connect to an ExpressRoute circuit, you must create a connection. Use the az network express-route connection create command to create a new connection with the specified parameters.

The following example command creates a connection named “myExpressRouteConnection” for the “myExpressRouteCircuit” circuit in the “myResourceGroup” resource group.

az network express-route connection create \
  --name myExpressRouteConnection \
  --resource-group myResourceGroup \
  --circuit-name myExpressRouteCircuit \
  --location eastus \
  --peer-id $PEER_ID \
  --vlan-id 200

In this command:

  • --name specifies the name of the connection.
  • --resource-group specifies the name of the resource group in which to create the connection.
  • --circuit-name specifies the name of the ExpressRoute circuit to connect to.
  • --location specifies the location of the connection.
  • --peer-id specifies the ID of the peering connection for the connection. This value will depend on the type of peering you selected when creating the circuit.
  • --vlan-id specifies the VLAN ID for the connection.

Step 4: Verify the connection

After you have created the connection, you can use the az network express-route connection show command to verify that the connection has been established.

The following example command retrieves the details of the “myExpressRouteConnection” connection in the “myResourceGroup” resource group:

az network express-route connection show \
  --name myExpressRouteConnection \
  --resource-group myResourceGroup

This command will return a JSON object with the details of the connection, including the connection status, the bandwidth, and the peering configuration.

Step 5: Configure your on-premises device or service provider

After you have created the ExpressRoute circuit and connection, you will need to configure your on-premises device or service provider to connect to the ExpressRoute circuit. The specific steps for this will depend on the type of device or service provider you are using.

You can use the az network express-route peering list command to retrieve the peering details for the ExpressRoute circuit. This command will return a JSON object with the details of the Microsoft peering, Azure private peering, and Azure public peering configurations.

az network express-route peering list \
  --circuit-name myExpressRouteCircuit \
  --resource-group myResourceGroup

Step 6: Update your routing tables

After your on-premises device or service provider is configured to connect to the ExpressRoute circuit, you will need to update your routing tables to direct traffic to the circuit. This will involve configuring your virtual network gateway to use the ExpressRoute connection for traffic to and from your on-premises network.

You can use the az network vnet-gateway update command to update the routing configuration for your virtual network gateway.

az network vnet-gateway update \
  --name myVirtualNetworkGateway \
  --resource-group myResourceGroup \
  --connection-name myExpressRouteConnection \
  --routing-weight 100

In this command, --connection-name specifies the name of the ExpressRoute connection, and --routing-weight specifies the routing weight for the connection.

Step 7: Test the connection

After you have configured your routing tables, you should test the connection to ensure that traffic is flowing through the ExpressRoute circuit. You can use tools like ping or traceroute to test connectivity between your on-premises network and resources in Azure.

Conclusion

In this tutorial, we have walked through the process of setting up an Azure ExpressRoute circuit and connection using the Azure CLI. We have covered the steps for creating the circuit and connection, configuring your on-premises device or service provider, updating your routing tables, and testing the connection.

Azure ExpressRoute provides a reliable and secure way to connect your on-premises infrastructure to Azure, with lower latency and higher bandwidths than standard internet-based connections. By following the steps in this tutorial, you can quickly and easily set up an ExpressRoute connection using the Azure CLI.