You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/vpn-gateway/create-gateway-powershell.md
+48-26Lines changed: 48 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,29 +1,40 @@
1
1
---
2
-
title: 'Create a route-based virtual network gateway: PowerShell'
2
+
title: 'Create a virtual network gateway: PowerShell'
3
3
titleSuffix: Azure VPN Gateway
4
4
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.
5
5
author: cherylmc
6
6
ms.service: vpn-gateway
7
7
ms.topic: how-to
8
-
ms.date: 05/07/2024
8
+
ms.date: 07/23/2024
9
9
ms.author: cherylmc
10
10
ms.custom: devx-track-azurepowershell
11
11
---
12
12
13
-
# Create a route-based VPN gateway using PowerShell
13
+
# Create a VPN gateway using PowerShell
14
14
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).
18
16
19
17
:::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":::
20
18
19
+
A VPN gateway is one part of a connection architecture to help you securely access resources within a virtual network.
20
+
21
21
* The left side of the diagram shows the virtual network and the VPN gateway that you create by using the steps in this article.
22
22
* 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).
23
23
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
+
24
35
## Before you begin
25
36
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.
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:
43
54
44
55
```azurepowershell-interactive
45
-
$virtualNetwork = New-AzVirtualNetwork `
56
+
$virtualnetwork = New-AzVirtualNetwork `
46
57
-ResourceGroupName TestRG1 `
47
58
-Location EastUS `
48
59
-Name VNet1 `
@@ -55,20 +66,20 @@ Create a subnet configuration using the [New-AzVirtualNetworkSubnetConfig](/powe
Set the subnet configuration for the virtual network using the [Set-AzVirtualNetwork](/powershell/module/az.network/Set-azVirtualNetwork) cmdlet.
62
73
63
74
```azurepowershell-interactive
64
-
$virtualNetwork | Set-AzVirtualNetwork
75
+
$virtualnetwork | Set-AzVirtualNetwork
65
76
```
66
77
67
78
## <aname="gwsubnet"></a>Add a gateway subnet
68
79
69
80
The gateway subnet contains the reserved IP addresses that the virtual network gateway services use. Use the following examples to add a gateway subnet:
## <aname="PublicIP"></a>Request a public IP address
90
101
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**.
## <aname="CreateGateway"></a>Create the VPN gateway
107
127
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.
## <aname="viewgwpip"></a>View the public IP address
124
145
125
-
To view the public IP address for your VPN gateway, use the [Get-AzPublicIpAddress](/powershell/module/az.network/Get-azPublicIpAddress) cmdlet.
146
+
## <aname="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:
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.
142
165
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