Skip to content

Commit c256a6b

Browse files
authored
Merge pull request #290826 from cherylmc/s2s-ps
S2S - new SKU PowerShell
2 parents d487f2b + fdfcfc6 commit c256a6b

File tree

2 files changed

+23
-156
lines changed

2 files changed

+23
-156
lines changed

articles/vpn-gateway/tutorial-site-to-site-portal.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ author: cherylmc
66
ms.author: cherylmc
77
ms.service: azure-vpn-gateway
88
ms.topic: tutorial
9-
ms.date: 08/13/2024
9+
ms.date: 11/20/2024
1010

1111
#customer intent: As a network engineer, I want to create a site-to-site VPN connection between my on-premises location and my Azure virtual network.
1212
---
@@ -145,10 +145,6 @@ You can configure more settings for your connection, if necessary. Otherwise, sk
145145

146146
[!INCLUDE [Verify the connection](../../includes/vpn-gateway-verify-connection-portal-include.md)]
147147

148-
## <a name="connectVM"></a>Connect to a virtual machine
149-
150-
[!INCLUDE [Connect to a VM](../../includes/vpn-gateway-connect-vm.md)]
151-
152148
## Optional steps
153149

154150
### <a name="reset"></a>Reset a gateway

articles/vpn-gateway/vpn-gateway-create-site-to-site-rm-powershell.md

Lines changed: 22 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: 'Connect your on-premises network to an Azure VNet: site-to-site VPN: PowerShell'
3-
description: Learn how to create a site-to-site VPN Gateway connection between your on-premises network and an Azure VNet using PowerShell.
2+
title: 'Connect your on-premises network to an Azure virtual network: site-to-site VPN: PowerShell'
3+
description: Learn how to create a site-to-site VPN Gateway connection between your on-premises network and an Azure virtual network using PowerShell.
44
titleSuffix: Azure VPN Gateway
55
author: cherylmc
66
ms.service: azure-vpn-gateway
@@ -10,191 +10,68 @@ ms.author: cherylmc
1010
ms.custom: devx-track-azurepowershell
1111

1212
---
13-
# Create a VNet with a site-to-site VPN connection using PowerShell
13+
# Create a site-to-site VPN connection using PowerShell
1414

15-
This article shows you how to use PowerShell to create a site-to-site VPN gateway connection from your on-premises network to the VNet. The steps in this article apply to the [Resource Manager deployment model](../azure-resource-manager/management/deployment-models.md). You can also create this configuration using a different deployment tool or deployment model by selecting a different option from the following list:
16-
17-
> [!div class="op_single_selector"]
18-
> * [Azure portal](./tutorial-site-to-site-portal.md)
19-
> * [PowerShell](vpn-gateway-create-site-to-site-rm-powershell.md)
20-
> * [CLI](vpn-gateway-howto-site-to-site-resource-manager-cli.md)
21-
> * [Azure portal (classic)](vpn-gateway-howto-site-to-site-classic-portal.md)
15+
This article shows you how to use PowerShell to create a site-to-site VPN gateway connection from your on-premises network to a virtual network (VNet). The steps in this article apply to the [Resource Manager deployment model](../azure-resource-manager/management/deployment-models.md).
2216

2317
A site-to-site VPN gateway connection is used to connect your on-premises network to an Azure virtual network over an IPsec/IKE (IKEv1 or IKEv2) VPN tunnel. This type of connection requires a VPN device located on-premises that has an externally facing public IP address assigned to it. For more information about VPN gateways, see [About VPN gateway](vpn-gateway-about-vpngateways.md).
2418

2519
:::image type="content" source="./media/tutorial-site-to-site-portal/diagram.png" alt-text="Diagram of site-to-site VPN Gateway cross-premises connections." lightbox="./media/tutorial-site-to-site-portal/diagram.png":::
2620

27-
## <a name="before"></a>Before you begin
21+
## Prerequisites
2822

29-
Verify that you have met the following criteria before beginning your configuration:
23+
Verify that your environment meets the following criteria before beginning your configuration:
3024

25+
* Verify that you have a functioning route-based VPN gateway. To create a VPN gateway, see [Create a VPN gateway](create-gateway-powershell.md).
3126
* Make sure you have a compatible VPN device and someone who is able to configure it. For more information about compatible VPN devices and device configuration, see [About VPN Devices](vpn-gateway-about-vpn-devices.md).
3227
* Verify that you have an externally facing public IPv4 address for your VPN device.
33-
* If you're unfamiliar with the IP address ranges located in your on-premises network configuration, you need to coordinate with someone who can provide those details for you. When you create this configuration, you must specify the IP address range prefixes that Azure will route to your on-premises location. None of the subnets of your on-premises network can over lap with the virtual network subnets that you want to connect to.
28+
* If you're unfamiliar with the IP address ranges located in your on-premises network configuration, you need to coordinate with someone who can provide those details for you. When you create this configuration, you must specify the IP address range prefixes that Azure routes to your on-premises location. None of the subnets of your on-premises network can over lap with the virtual network subnets that you want to connect to.
3429

3530
### Azure PowerShell
3631

3732
[!INCLUDE [powershell](../../includes/vpn-gateway-cloud-shell-powershell-about.md)]
3833

39-
### <a name="example"></a>Example values
40-
41-
The examples in this article use the following values. You can use these values to create a test environment, or refer to them to better understand the examples in this article.
42-
43-
```
44-
#Example values
45-
46-
VnetName = VNet1
47-
ResourceGroup = TestRG1
48-
Location = East US
49-
AddressSpace = 10.1.0.0/16
50-
SubnetName = Frontend
51-
Subnet = 10.1.0.0/24
52-
GatewaySubnet = 10.1.255.0/27
53-
LocalNetworkGatewayName = Site1
54-
LNG Public IP = <On-premises VPN device IP address>
55-
Local Address Prefixes = 10.0.0.0/24, 20.0.0.0/24
56-
Gateway Name = VNet1GW
57-
PublicIP = VNet1GWPIP
58-
Gateway IP Config = gwipconfig1
59-
VPNType = RouteBased
60-
GatewayType = Vpn
61-
ConnectionName = VNet1toSite1
62-
```
63-
64-
## <a name="VNet"></a>1. Create a virtual network and a gateway subnet
65-
66-
If you don't already have a virtual network, create one. When creating a virtual network, make sure that the address spaces you specify don't overlap any of the address spaces that you have on your on-premises network.
67-
68-
> [!NOTE]
69-
> In order for this VNet to connect to an on-premises location, you need to coordinate with your on-premises network administrator to carve out an IP address range that you can use specifically for this virtual network. If a duplicate address range exists on both sides of the VPN connection, traffic does not route the way you might expect it to. Additionally, if you want to connect this VNet to another VNet, the address space cannot overlap with other VNet. Take care to plan your network configuration accordingly.
70-
71-
### About the gateway subnet
72-
73-
[!INCLUDE [About gateway subnets](../../includes/vpn-gateway-about-gwsubnet-include.md)]
74-
75-
[!INCLUDE [No NSG warning](../../includes/vpn-gateway-no-nsg-include.md)]
76-
77-
### <a name="vnet"></a>Create a virtual network and a gateway subnet
78-
79-
This example creates a virtual network and a gateway subnet. If you already have a virtual network that you need to add a gateway subnet to, see [To add a gateway subnet to a virtual network you have already created](#gatewaysubnet).
80-
81-
Create a resource group:
82-
83-
```azurepowershell-interactive
84-
New-AzResourceGroup -Name TestRG1 -Location 'East US'
85-
```
86-
87-
Create your virtual network.
88-
89-
1. Set the variables.
90-
91-
```azurepowershell-interactive
92-
$subnet1 = New-AzVirtualNetworkSubnetConfig -Name 'GatewaySubnet' -AddressPrefix 10.1.255.0/27
93-
$subnet2 = New-AzVirtualNetworkSubnetConfig -Name 'Frontend' -AddressPrefix 10.1.0.0/24
94-
```
95-
96-
1. Create the VNet.
97-
98-
```azurepowershell-interactive
99-
New-AzVirtualNetwork -Name VNet1 -ResourceGroupName TestRG1 `
100-
-Location 'East US' -AddressPrefix 10.1.0.0/16 -Subnet $subnet1, $subnet2
101-
```
102-
103-
#### <a name="gatewaysubnet"></a>To add a gateway subnet to a virtual network you have already created
104-
105-
Use the steps in this section if you already have a virtual network, but need to add a gateway subnet.
106-
107-
1. Set the variables.
108-
109-
```azurepowershell-interactive
110-
$vnet = Get-AzVirtualNetwork -ResourceGroupName TestRG1 -Name VNet1
111-
```
112-
113-
1. Create the gateway subnet.
114-
115-
```azurepowershell-interactive
116-
Add-AzVirtualNetworkSubnetConfig -Name 'GatewaySubnet' -AddressPrefix 10.1.255.0/27 -VirtualNetwork $vnet
117-
```
118-
119-
1. Set the configuration.
120-
121-
```azurepowershell-interactive
122-
Set-AzVirtualNetwork -VirtualNetwork $vnet
123-
```
34+
## <a name="localnet"></a>Create a local network gateway
12435

125-
## 2. <a name="localnet"></a>Create the local network gateway
126-
127-
The local network gateway (LNG) typically refers to your on-premises location. It isn't the same as a virtual network gateway. You give the site a name by which Azure can refer to it, then specify the IP address of the on-premises VPN device to which you will create a connection. You also specify the IP address prefixes that will be routed through the VPN gateway to the VPN device. The address prefixes you specify are the prefixes located on your on-premises network. If your on-premises network changes, you can easily update the prefixes.
36+
The local network gateway (LNG) typically refers to your on-premises location. It isn't the same as a virtual network gateway. You give the site a name by which Azure can refer to it, then specify the IP address of the on-premises VPN device to which you'll create a connection. You also specify the IP address prefixes that are routed through the VPN gateway to the VPN device. The address prefixes you specify are the prefixes located on your on-premises network. If your on-premises network changes, you can easily update the prefixes.
12837

12938
Select one of the following examples. The values used in the examples are:
13039

131-
* The *GatewayIPAddress* is the IP address of your on-premises VPN device.
40+
* The *GatewayIPAddress* is the IP address of your on-premises VPN device, not your Azure VPN gateway.
13241
* The *AddressPrefix* is your on-premises address space.
13342

13443
**Single address prefix example**
13544

13645
```azurepowershell-interactive
13746
New-AzLocalNetworkGateway -Name Site1 -ResourceGroupName TestRG1 `
138-
-Location 'East US' -GatewayIpAddress '23.99.221.164' -AddressPrefix '10.0.0.0/24'
47+
-Location 'East US' -GatewayIpAddress '[IP address of your on-premises VPN device]' -AddressPrefix '10.0.0.0/24'
13948
```
14049

14150
**Multiple address prefix example**
14251

14352
```azurepowershell-interactive
14453
New-AzLocalNetworkGateway -Name Site1 -ResourceGroupName TestRG1 `
145-
-Location 'East US' -GatewayIpAddress '23.99.221.164' -AddressPrefix @('20.0.0.0/24','10.0.0.0/24')
54+
-Location 'East US' -GatewayIpAddress '[IP address of your on-premises VPN device]' -AddressPrefix @('192.168.0.0/24','10.0.0.0/24')
14655
```
14756

148-
## <a name="PublicIP"></a>3. Request a public IP address
149-
150-
A VPN gateway must have a public IP address. You first request the IP address resource, and then refer to it when creating your virtual network gateway. The IP address is dynamically assigned to the resource when the VPN gateway is created. The only time the public IP address changes is when the gateway is deleted and re-created. It doesn't change across resizing, resetting, or other internal maintenance/upgrades of your VPN gateway.
151-
152-
Request a public IP address for your virtual network VPN gateway.
153-
154-
```azurepowershell-interactive
155-
$gwpip= New-AzPublicIpAddress -Name VNet1GWPIP -ResourceGroupName TestRG1 -Location 'East US' -AllocationMethod Static -Sku Standard
156-
```
157-
158-
## <a name="GatewayIPConfig"></a>4. Create the gateway IP addressing configuration
159-
160-
The gateway configuration defines the subnet (the 'GatewaySubnet') and the public IP address to use. Use the following example to create your gateway configuration:
161-
162-
```azurepowershell-interactive
163-
$vnet = Get-AzVirtualNetwork -Name VNet1 -ResourceGroupName TestRG1
164-
$subnet = Get-AzVirtualNetworkSubnetConfig -Name 'GatewaySubnet' -VirtualNetwork $vnet
165-
$gwipconfig = New-AzVirtualNetworkGatewayIpConfig -Name gwipconfig1 -SubnetId $subnet.Id -PublicIpAddressId $gwpip.Id
166-
```
167-
168-
## <a name="CreateGateway"></a>5. Create the VPN gateway
169-
170-
Create the virtual network VPN gateway. Creating a gateway can often take 45 minutes or more, depending on the selected gateway SKU. The following values are used in the example:
171-
172-
* The *-GatewayType* for a site-to-site configuration is *Vpn*. The gateway type is always specific to the configuration that you're implementing. For example, other gateway configurations might require -GatewayType ExpressRoute.
173-
* The *-VpnType* can be *RouteBased* (referred to as a Dynamic Gateway in some documentation), or *PolicyBased* (referred to as a Static Gateway in some documentation). For more information about VPN gateway types, see [About VPN Gateway](vpn-gateway-about-vpngateways.md).
174-
* Select the Gateway SKU that you want to use. There are configuration limitations for certain SKUs. For more information, see [Gateway SKUs](vpn-gateway-about-vpn-gateway-settings.md#gwsku). If you get an error when creating the VPN gateway regarding the -GatewaySku, verify that you have installed the latest version of the PowerShell cmdlets.
175-
176-
```azurepowershell-interactive
177-
New-AzVirtualNetworkGateway -Name VNet1GW -ResourceGroupName TestRG1 `
178-
-Location 'East US' -IpConfigurations $gwipconfig -GatewayType Vpn `
179-
-VpnType RouteBased -GatewaySku VpnGw2
180-
```
181-
182-
## <a name="ConfigureVPNDevice"></a>6. Configure your VPN device
57+
## <a name="ConfigureVPNDevice"></a>Configure your VPN device
18358

18459
Site-to-site connections to an on-premises network require a VPN device. In this step, you configure your VPN device. When configuring your VPN device, you need the following items:
18560

186-
* A shared key. This is the same shared key that you specify when creating your site-to-site VPN connection. In our examples, we use a basic shared key. We recommend that you generate a more complex key to use.
187-
* The public IP address of your virtual network gateway. You can view the public IP address by using the Azure portal, PowerShell, or CLI. To find the public IP address of your virtual network gateway using PowerShell, use the following example. In this example, VNet1GWPIP is the name of the public IP address resource that you created in an earlier step.
61+
* A shared key. You'll use this shared key both when you configure your VPN device, and when you create your site-to-site VPN connection. In our examples, we use a basic shared key. We recommend that you generate a more complex key to use. The important thing is that the key is the same on both sides of the connection.
62+
* The public IP address of your virtual network gateway. You can view the public IP address by using the Azure portal, PowerShell, or CLI. To find the public IP address of your virtual network gateway using PowerShell, use the following example. In this example, VNet1GWpip1 is the name of the public IP address resource that you created in an earlier step.
18863

18964
```azurepowershell-interactive
190-
Get-AzPublicIpAddress -Name VNet1GWPIP -ResourceGroupName TestRG1
65+
Get-AzPublicIpAddress -Name VNet1GWpip1 -ResourceGroupName TestRG1
19166
```
19267

19368
[!INCLUDE [Configure VPN device](../../includes/vpn-gateway-configure-vpn-device-rm-include.md)]
19469

195-
## <a name="CreateConnection"></a>7. Create the VPN connection
70+
## <a name="CreateConnection"></a>Create the VPN connection
19671

197-
Next, create the site-to-site VPN connection between your virtual network gateway and your VPN device. Be sure to replace the values with your own. The shared key must match the value you used for your VPN device configuration. Notice that the '-ConnectionType' for site-to-site is **IPsec**.
72+
Create a site-to-site VPN connection between your virtual network gateway and your on-premises VPN device. If you're using an active-active mode gateway (recommended), each gateway VM instance has a separate IP address. To properly configure [highly available connectivity](vpn-gateway-highlyavailable.md), you must establish a tunnel between each VM instance and your VPN device. Both tunnels are part of the same connection.
73+
74+
Be sure to replace the values in the examples with your own. The shared key must match the value you used for your VPN device configuration. Notice that the '-ConnectionType' for site-to-site is **IPsec**.
19875

19976
1. Set the variables.
20077

@@ -211,18 +88,12 @@ Next, create the site-to-site VPN connection between your virtual network gatewa
21188
-ConnectionType IPsec -SharedKey 'abc123'
21289
```
21390

214-
After a short while, the connection will be established.
215-
216-
## <a name="toverify"></a>8. Verify the VPN connection
91+
## <a name="toverify"></a>Verify the VPN connection
21792

21893
There are a few different ways to verify your VPN connection.
21994

22095
[!INCLUDE [Verify connection](../../includes/vpn-gateway-verify-connection-ps-rm-include.md)]
22196

222-
## <a name="connectVM"></a>To connect to a virtual machine
223-
224-
[!INCLUDE [Connect to a VM](../../includes/vpn-gateway-connect-vm.md)]
225-
22697
## <a name="modify"></a>To modify IP address prefixes for a local network gateway
22798

22899
If the IP address prefixes that you want routed to your on-premises location change, you can modify the local network gateway. When using these examples, modify the values to match your environment.

0 commit comments

Comments
 (0)