Skip to content

Files

Latest commit

1627ff4 · May 13, 2022

History

History
53 lines (37 loc) · 2.43 KB

howto-connect-vnet-hub-powershell.md

File metadata and controls

53 lines (37 loc) · 2.43 KB
title titleSuffix description author ms.service ms.topic ms.date ms.author
Connect a VNet to a Virtual WAN hub - PowerShell
Azure Virtual WAN
Learn how to connect a VNet to a Virtual WAN hub using PowerShell.
reasuquo
virtual-wan
how-to
05/13/2022
reasuquo

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 the Azure portal to complete this task. Repeat these steps for each VNet that you want to connect.

Note

  • 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.

Prerequisites

  • Verify that you have an Azure subscription. If you don't already have an Azure subscription, you can activate your MSDN subscriber benefits or sign up for a free account.
  • This tutorial creates a NAT rule on a VPN gateway that will be associated with a VPN site connection. The steps assume that you have an existing Virtual WAN VPN gateway connection to two branches with overlapping address spaces.

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 "myVirtualWAN"
    $virtualHub = Get-AzVirtualHub -ResourceGroupName "testRG" -Name "westushub"
    $remoteVirtualNetwork = Get-AzVirtualNetwork -Name "MyVirtualNetwork" -ResourceGroupName "testRG" 
    
  2. You can create a connection between a new virtual network or an already existing virtual network to peer the Virtual Network to the Virtual Hub. To create the connection:

    New-AzVirtualHubVnetConnection -ResourceGroupName "testRG" -VirtualHubName "westushub" -Name "testvnetconnection" -RemoteVirtualNetwork $remoteVirtualNetwork
    

Next steps

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