Skip to content

Commit 26ec5a2

Browse files
authored
Merge pull request #281552 from cherylmc/final-psgateway
VPN Gateway create gateway PS - new article
2 parents 4363de2 + 1be0e7a commit 26ec5a2

File tree

4 files changed

+56
-29
lines changed

4 files changed

+56
-29
lines changed

.openpublishing.redirection.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,6 +1604,11 @@
16041604
"redirect_url": "/azure/vpn-gateway/tutorial-create-gateway-portal",
16051605
"redirect_document_id": false
16061606
},
1607+
{
1608+
"source_path_from_root": "/articles/vpn-gateway/create-routebased-vpn-gateway-powershell.md",
1609+
"redirect_url": "/azure/vpn-gateway/create-gateway-powershell",
1610+
"redirect_document_id": false
1611+
},
16071612
{
16081613
"source_path_from_root": "/articles/vpn-gateway/vpn-gateway-howto-openvpn-clients.md",
16091614
"redirect_url": "/azure/vpn-gateway/point-to-site-vpn-client-cert-windows",

articles/vpn-gateway/TOC.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
- name: Azure portal
7171
href: tutorial-create-gateway-portal.md
7272
- name: Azure PowerShell
73-
href: create-routebased-vpn-gateway-powershell.md
73+
href: create-gateway-powershell.md
7474
- name: Azure CLI
7575
href: create-routebased-vpn-gateway-cli.md
7676
- name: Create a Basic SKU gateway

articles/vpn-gateway/about-gateway-skus.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Learn about VPN Gateway SKUs.
44
author: cherylmc
55
ms.service: vpn-gateway
66
ms.topic: conceptual
7-
ms.date: 01/23/2024
7+
ms.date: 07/23/2024
88
ms.author: cherylmc
99

1010
---
@@ -75,7 +75,7 @@ For information about working with the legacy gateway SKUs (Basic, Standard, and
7575
You specify the gateway SKU when you create your VPN Gateway. See the following article for steps:
7676

7777
* [Azure portal](tutorial-create-gateway-portal.md)
78-
* [PowerShell](create-routebased-vpn-gateway-powershell.md)
78+
* [PowerShell](create-gateway-powershell.md)
7979
* [Azure CLI](create-routebased-vpn-gateway-cli.md)
8080

8181
## <a name="resizechange"></a>Change or resize a SKU

articles/vpn-gateway/create-routebased-vpn-gateway-powershell.md renamed to articles/vpn-gateway/create-gateway-powershell.md

Lines changed: 48 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,40 @@
11
---
2-
title: 'Create a route-based virtual network gateway: PowerShell'
2+
title: 'Create a virtual network gateway: PowerShell'
33
titleSuffix: Azure VPN Gateway
44
description: Learn how to create a route-based virtual network gateway for a VPN connection to your on-premises network, or to connect virtual networks.
55
author: cherylmc
66
ms.service: vpn-gateway
77
ms.topic: how-to
8-
ms.date: 05/07/2024
8+
ms.date: 07/23/2024
99
ms.author: cherylmc
1010
ms.custom: devx-track-azurepowershell
1111
---
1212

13-
# Create a route-based VPN gateway using PowerShell
13+
# Create a VPN gateway using PowerShell
1414

15-
This article helps you quickly create a route-based Azure VPN gateway using PowerShell. A VPN gateway is used when creating a VPN connection to your on-premises network. You can also use a VPN gateway to connect VNets.
16-
17-
A VPN gateway is just one part of a connection architecture to help you securely access resources within a virtual network.
15+
This article helps you create an Azure VPN gateway using PowerShell. A VPN gateway is used when creating a VPN connection to your on-premises network. You can also use a VPN gateway to connect VNets. For more comprehensive information about some of the settings in this article, see [Create a VPN gateway - portal](tutorial-create-gateway-portal.md).
1816

1917
:::image type="content" source="./media/tutorial-create-gateway-portal/gateway-diagram.png" alt-text="Diagram that shows a virtual network and a VPN gateway." lightbox="./media/tutorial-create-gateway-portal/gateway-diagram-expand.png":::
2018

19+
A VPN gateway is one part of a connection architecture to help you securely access resources within a virtual network.
20+
2121
* The left side of the diagram shows the virtual network and the VPN gateway that you create by using the steps in this article.
2222
* You can later add different types of connections, as shown on the right side of the diagram. For example, you can create [site-to-site](tutorial-site-to-site-portal.md) and [point-to-site](point-to-site-about.md) connections. To view different design architectures that you can build, see [VPN gateway design](design.md).
2323

24+
The steps in this article create a virtual network, a subnet, a gateway subnet, and a route-based, zone-redundant active-active VPN gateway (virtual network gateway) using the Generation 2 VpnGw2AZ SKU. If you want to create a VPN gateway using the **Basic** SKU instead, see [Create a Basic SKU VPN gateway](create-gateway-basic-sku-powershell.md). Once the gateway creation completes, you can then create connections.
25+
26+
Active-active gateways differ from active-standby gateways in the following ways:
27+
28+
* Active-active gateways have two Gateway IP configurations and two public IP addresses.
29+
* Active-active gateways have active-active setting enabled.
30+
* The virtual network gateway SKU can't be Basic or Standard.
31+
32+
For more information about active-active gateways, see [Highly Available cross-premises and VNet-to-VNet connectivity](vpn-gateway-highlyavailable.md).
33+
For more information about availability zones and zone redundant gateways, see [What are availability zones](https://learn.microsoft.com/azure/reliability/availability-zones-overview?toc=%2Fazure%2Fvpn-gateway%2Ftoc.json&tabs=azure-cli#availability-zones)?
34+
2435
## Before you begin
2536

26-
The steps in this article will create a VNet, a subnet, a gateway subnet, and a route-based VPN gateway (virtual network gateway). Once the gateway creation has completed, you can then create connections. These steps require an Azure subscription. If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
37+
These steps require an Azure subscription. If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
2738

2839
### Working with Azure PowerShell
2940

@@ -42,7 +53,7 @@ New-AzResourceGroup -Name TestRG1 -Location EastUS
4253
Create a virtual network with [New-AzVirtualNetwork](/powershell/module/az.network/new-azvirtualnetwork). The following example creates a virtual network named **VNet1** in the **EastUS** location:
4354

4455
```azurepowershell-interactive
45-
$virtualNetwork = New-AzVirtualNetwork `
56+
$virtualnetwork = New-AzVirtualNetwork `
4657
-ResourceGroupName TestRG1 `
4758
-Location EastUS `
4859
-Name VNet1 `
@@ -55,20 +66,20 @@ Create a subnet configuration using the [New-AzVirtualNetworkSubnetConfig](/powe
5566
$subnetConfig = Add-AzVirtualNetworkSubnetConfig `
5667
-Name Frontend `
5768
-AddressPrefix 10.1.0.0/24 `
58-
-VirtualNetwork $virtualNetwork
69+
-VirtualNetwork $virtualnetwork
5970
```
6071

6172
Set the subnet configuration for the virtual network using the [Set-AzVirtualNetwork](/powershell/module/az.network/Set-azVirtualNetwork) cmdlet.
6273

6374
```azurepowershell-interactive
64-
$virtualNetwork | Set-AzVirtualNetwork
75+
$virtualnetwork | Set-AzVirtualNetwork
6576
```
6677

6778
## <a name="gwsubnet"></a>Add a gateway subnet
6879

6980
The gateway subnet contains the reserved IP addresses that the virtual network gateway services use. Use the following examples to add a gateway subnet:
7081

71-
Set a variable for your VNet.
82+
Set a variable for your virtual network.
7283

7384
```azurepowershell-interactive
7485
$vnet = Get-AzVirtualNetwork -ResourceGroupName TestRG1 -Name VNet1
@@ -88,29 +99,40 @@ $vnet | Set-AzVirtualNetwork
8899

89100
## <a name="PublicIP"></a>Request a public IP address
90101

91-
A VPN gateway must have an allocated public IP address. When you create a connection to a VPN gateway, this is the IP address that you specify. Use the following example to request a public IP address. Note that if you want to create a VPN gateway using the Basic gateway SKU, use the following values when requesting a public IP address: `-AllocationMethod Dynamic -Sku Basic`.
102+
Each VPN gateway must have an allocated public IP address. When you create a connection to a VPN gateway, this is the IP address that you specify. In this exercise, we create an active-active zone-redundant VPN gateway environment. That means that two Standard public IP addresses are required, one for each gateway, and we must also specify the Zone setting. This example specifies a zone-redundant configuration because it specifies all 3 regional zones.
103+
104+
Use the following examples to request a public IP address for each gateway. The allocation method must be **Static**.
92105

93106
```azurepowershell-interactive
94-
$gwpip = New-AzPublicIpAddress -Name "VNet1GWIP" -ResourceGroupName "TestRG1" -Location "EastUS" -AllocationMethod Static
107+
$gw1pip1 = New-AzPublicIpAddress -Name "VNet1GWpip1" -ResourceGroupName "TestRG1" -Location "EastUS" -AllocationMethod Static -Sku Standard -Zone 1,2,3
108+
```
109+
110+
```azurepowershell-interactive
111+
$gw1pip2 = New-AzPublicIpAddress -Name "VNet1GWpip2" -ResourceGroupName "TestRG1" -Location "EastUS" -AllocationMethod Static -Sku Standard -Zone 1,2,3
95112
```
96113

97114
## <a name="GatewayIPConfig"></a>Create the gateway IP address configuration
98115

99-
The gateway configuration defines the subnet and the public IP address to use. Use the following example to create your gateway configuration:
116+
The gateway configuration defines the subnet and the public IP address to use. Use the following example to create your gateway configuration.
100117

101118
```azurepowershell-interactive
102119
$vnet = Get-AzVirtualNetwork -Name VNet1 -ResourceGroupName TestRG1
103120
$subnet = Get-AzVirtualNetworkSubnetConfig -Name 'GatewaySubnet' -VirtualNetwork $vnet
104-
$gwipconfig = New-AzVirtualNetworkGatewayIpConfig -Name gwipconfig1 -SubnetId $subnet.Id -PublicIpAddressId $gwpip.Id
121+
122+
$gwipconfig1 = New-AzVirtualNetworkGatewayIpConfig -Name gwipconfig1 -SubnetId $subnet.Id -PublicIpAddressId $gw1pip1.Id
123+
$gwipconfig2 = New-AzVirtualNetworkGatewayIpConfig -Name gwipconfig2 -SubnetId $subnet.Id -PublicIpAddressId $gw1pip2.Id
105124
```
125+
106126
## <a name="CreateGateway"></a>Create the VPN gateway
107127

108-
Creating a gateway can often take 45 minutes or more, depending on the selected gateway SKU. Once the gateway has completed, you can create a connection between your virtual network and another VNet. Or, create a connection between your virtual network and an on-premises location. Create a VPN gateway using the [New-AzVirtualNetworkGateway](/powershell/module/az.network/New-azVirtualNetworkGateway) cmdlet.
128+
Creating a gateway can often take 45 minutes or more, depending on the selected gateway SKU. Once the gateway is created, you can create a connection between your virtual network and another virtual network. Or, create a connection between your virtual network and an on-premises location.
129+
130+
Create a VPN gateway using the [New-AzVirtualNetworkGateway](/powershell/module/az.network/New-azVirtualNetworkGateway) cmdlet. Notice in the examples that both public IP addresses are referenced and the gateway is configured as active-active. In the example, we add the optional `-Debug` switch.
109131

110132
```azurepowershell-interactive
111133
New-AzVirtualNetworkGateway -Name VNet1GW -ResourceGroupName TestRG1 `
112-
-Location "East US" -IpConfigurations $gwipconfig -GatewayType "Vpn" `
113-
-VpnType "RouteBased" -GatewaySku VpnGw2 -VpnGatewayGeneration "Generation2"
134+
-Location "East US" -IpConfigurations $gwipconfig1,$gwipconfig2 -GatewayType "Vpn" -VpnType RouteBased `
135+
-GatewaySku VpnGw2AZ -VpnGatewayGeneration Generation2 -EnableActiveActiveFeature -Debug
114136
```
115137

116138
## <a name="viewgw"></a>View the VPN gateway
@@ -120,12 +142,13 @@ You can view the VPN gateway using the [Get-AzVirtualNetworkGateway](/powershell
120142
```azurepowershell-interactive
121143
Get-AzVirtualNetworkGateway -Name Vnet1GW -ResourceGroup TestRG1
122144
```
123-
## <a name="viewgwpip"></a>View the public IP address
124145

125-
To view the public IP address for your VPN gateway, use the [Get-AzPublicIpAddress](/powershell/module/az.network/Get-azPublicIpAddress) cmdlet.
146+
## <a name="viewgwpip"></a>View the public IP addresses
147+
148+
To view the public IP address for your VPN gateway, use the [Get-AzPublicIpAddress](/powershell/module/az.network/Get-azPublicIpAddress) cmdlet. Example:
126149

127150
```azurepowershell-interactive
128-
Get-AzPublicIpAddress -Name VNet1GWIP -ResourceGroupName TestRG1
151+
Get-AzPublicIpAddress -Name VNet1GWpip1 -ResourceGroupName TestRG1
129152
```
130153

131154
## Clean up resources
@@ -138,9 +161,8 @@ Remove-AzResourceGroup -Name TestRG1
138161

139162
## Next steps
140163

141-
Once the gateway has finished creating, you can create a connection between your virtual network and another VNet. Or, create a connection between your virtual network and an on-premises location.
164+
Once the gateway has finished creating, you can create a connection between your virtual network and another virtual network. Or, create a connection between your virtual network and an on-premises location.
142165

143-
> [!div class="nextstepaction"]
144-
> [Create a site-to-site connection](vpn-gateway-create-site-to-site-rm-powershell.md)<br><br>
145-
> [Create a point-to-site connection](vpn-gateway-howto-point-to-site-rm-ps.md)<br><br>
146-
> [Create a connection to another VNet](vpn-gateway-vnet-vnet-rm-ps.md)
166+
* [Create a site-to-site connection](vpn-gateway-create-site-to-site-rm-powershell.md)<br><br>
167+
* [Create a point-to-site connection](vpn-gateway-howto-point-to-site-rm-ps.md)<br><br>
168+
* [Create a connection to another VNet](vpn-gateway-vnet-vnet-rm-ps.md)

0 commit comments

Comments
 (0)