Skip to content

Latest commit

 

History

History
60 lines (42 loc) · 3.09 KB

File metadata and controls

60 lines (42 loc) · 3.09 KB
title Connect a VNet to a Virtual WAN hub - PowerShell
titleSuffix Azure Virtual WAN
description Learn how to connect a VNet to a Virtual WAN hub using PowerShell.
author cherylmc
ms.service azure-virtual-wan
ms.custom devx-track-azurepowershell
ms.topic how-to
ms.date 06/15/2023
ms.author cherylmc

Connect a virtual network to a Virtual WAN hub - PowerShell

This article helps you connect your virtual network to your virtual hub using PowerShell. You can also use Azure portal to complete this task. Repeat these steps for each VNet that you want to connect.

Before you create a connection, be aware of the following:

  • A virtual network can only be connected to one virtual hub at a time.

  • In order to connect it to a virtual hub, the remote virtual network can't have a gateway (ExpressRoute or VPN) or RouteServer.

  • To connect a cross-tenant remote virtual network to the virtual hub, refer to Connect cross-tenant virtual networks to a Virtual WAN hub.

  • Make sure to check if you'd like to enable bypass next hop IP for workloads within this VNet for your connection.

  • Some configuration settings, such as Propagate static route, can only be configured in the Azure portal at this time. See the Azure portal version of this article for steps.

Important

If VPN gateways are present in the virtual hub, this operation as well as any other write operation on the connected VNet can cause disconnection to point-to-site clients as well as reconnection of site-to-site tunnels and BGP sessions.

Prerequisites

Azure PowerShell

[!INCLUDE PowerShell]

Sign in

[!INCLUDE sign in]

Add a connection

  1. Declare the variables for the existing resources, including the existing virtual network.

    $resourceGroup = Get-AzResourceGroup -ResourceGroupName "TestRG" 
    $virtualWan = Get-AzVirtualWan -ResourceGroupName "TestRG" -Name "TestVWAN1"
    $virtualHub = Get-AzVirtualHub -ResourceGroupName "TestRG" -Name "Hub1"
    $remoteVirtualNetwork = Get-AzVirtualNetwork -Name "VNet1" -ResourceGroupName "TestRG" 
    
  2. Create a connection to peer the virtual network to the virtual hub.

    New-AzVirtualHubVnetConnection -ResourceGroupName "TestRG" -VirtualHubName "Hub1" -Name "VNet1-connection" -RemoteVirtualNetwork $remoteVirtualNetwork
    

Next steps

For more information about Virtual WAN, see the Virtual WAN FAQ.