How to configure virtual hub routing - Azure PowerShell

A virtual hub can contain multiple gateways such as a site-to-site VPN gateway, ExpressRoute gateway, point-to-site gateway, and Azure Firewall. The routing capabilities in the virtual hub are provided by a router that manages all routing, including transit routing, between the gateways using Border Gateway Protocol (BGP). The virtual hub router also provides transit connectivity between virtual networks that connect to a virtual hub and can support up to an aggregate throughput of 50 Gbps. These routing capabilities apply to customers using Standard Virtual WANs. For more information, see About virtual hub routing.

This article helps you configure virtual hub routing using Azure PowerShell. You can also configure virtual hub routing using the Azure portal steps.

Create a route table

  1. Get the virtual hub details to create route table.

    $virtualhub = Get-AzVirtualHub -ResourceGroupName "[resource group name]" -Name "[virtualhub name]"
    
  2. Get VNet connection details to be used as next hop.

    $hubVnetConnection = Get-AzVirtualHubVnetConnection -Name "[HubconnectionName]" -ParentResourceName "[Hub Name]" -ResourceGroupName "[resource group name]"
    
  3. Create a route to be associated with the virtual hub $virtualhub. The -NextHop is the virtual network connection $hubVnetConnection. Nexthop can be list of virtual network connections or Azure Firewall.

    $route = New-AzVHubRoute -Name "[Route Name]" -Destination "[@("Destination prefix")]" -DestinationType "CIDR" -NextHop $hubVnetConnection.Id -NextHopType "ResourceId"
    
  4. Create the route table using the route object created in the previous step, $route, and associate it to the virtual hub $virtualhub.

    New-AzVHubRouteTable -Name "testRouteTable" -ParentObject $virtualhub -Route @($route) -Label @("testLabel")
    

Delete a route table

Remove-AzVirtualHubRouteTable -ResourceGroupName "[resource group name]" -HubName "virtualhubname" -Name "routeTablename"

Update a route table

The steps in this section help you update a route table. For example, update an existing route's next hop to an existing Azure Firewall.

$firewall = Get-AzFirewall -Name "[firewall name]]" -ResourceGroupName "[resource group name]"
$newroute = New-AzVHubRoute -Name "[Route Name]" -Destination @("0.0.0.0/0") -DestinationType "CIDR" -NextHop $firewall.Id -NextHopType "ResourceId"
Update-AzVHubRouteTable -ResourceGroupName "[resource group name]" -VirtualHubName ["virtual hub name"] -Name ["route table name"] -Route @($newroute)

Next steps