This article helps you create a Basic SKU Azure VPN gateway using PowerShell. The VPN gateway you create can be either RouteBased, or PolicyBased, depending on your connection requirements. 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.
Important
The Basic SKU has certain feature and performance limitations and shouldn't be used for production purposes. For more information about SKUs, see About gateway SKUs.
The left side of the diagram shows the virtual network and the VPN gateway that you create by using the steps in this article.
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 and point-to-site connections. To view different design architectures that you can build, see VPN gateway design.
The steps in this article create a virtual network, a subnet, a gateway subnet, and a VPN gateway (virtual network gateway) using the Basic SKU. The article steps specify a RouteBased VPN type. You can also specify a PolicyBased VPN type using the steps in this article. Once the gateway creation completes, you can then create connections. If you want to create a gateway using a SKU other than the Basic SKU, see the Portal article.
The Basic SKU has certain feature and performance limitations and shouldn't be used for production purposes. Some of the limitations of the Basic SKU are:
A Basic SKU VPN gateway uses a Basic SKU public IP address, not Standard.
The public IP address allocation method for a Basic SKU VPN gateway must be Dynamic, not Static.
The Basic SKU can only be configured using PowerShell or Azure CLI.
The Basic SKU doesn't support IPv6.
The Basic SKU doesn't support RADIUS authentication.
Before you begin
These steps require an Azure subscription. If you don't have an Azure subscription, create a free account before you begin.
Working with Azure PowerShell
This article uses PowerShell cmdlets. To run the cmdlets, you can use Azure Cloud Shell. Cloud Shell is a free interactive shell that you can use to run the steps in this article. It has common Azure tools preinstalled and configured to use with your account.
To open Cloud Shell, just select Open Cloudshell from the upper-right corner of a code block. You can also open Cloud Shell on a separate browser tab by going to https://shell.azure.com/powershell. Select Copy to copy the blocks of code, paste them into Cloud Shell, and select the Enter key to run them.
You can also install and run the Azure PowerShell cmdlets locally on your computer. PowerShell cmdlets are updated frequently. If you haven't installed the latest version, the values specified in the instructions may fail. To find the versions of Azure PowerShell installed on your computer, use the Get-Module -ListAvailable Az cmdlet. To install or update, see Install the Azure PowerShell module.
Create a resource group
Create an Azure resource group with New-AzResourceGroup. A resource group is a logical container into which Azure resources are deployed and managed. If you're running PowerShell locally, open your PowerShell console with elevated privileges and connect to Azure using the Connect-AzAccount command.
Set the subnet configuration for the virtual network using the Set-AzVirtualNetwork cmdlet.
Azure PowerShell
$virtualnetwork | Set-AzVirtualNetwork
Add a gateway subnet
The gateway subnet contains the reserved IP addresses that the virtual network gateway services use. Use the following examples to add a gateway subnet:
Set the subnet configuration for the virtual network using the Set-AzVirtualNetwork cmdlet.
Azure PowerShell
$vnet | Set-AzVirtualNetwork
Request a public IP address
Each VPN gateway must have an allocated public IP address. At this time, Basic SKU VPN gateways still use Dynamic allocation method public IP address and the Basic public IP address SKU. These requirements are different from other VPN Gateway SKUs.
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.
Create a VPN gateway using the New-AzVirtualNetworkGateway cmdlet. In this example, we create a route-based Basic SKU VPN gateway. You can create a policy-based gateway instead by specifying -VpnType "PolicyBased".
When you no longer need the resources you created, use the Remove-AzResourceGroup command to delete the resource group. This deletes the resource group and all of the resources it contains.
Azure PowerShell
Remove-AzResourceGroup -Name TestRG1
Next steps
Once the gateway finishes 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. See the following articles:
Network configuration and the use of Virtual Private Networks (VPNs) is integral to the success of collaborative working. In this module, we look at how to monitor and troubleshoot site-to-site and point-to-site VPNs. AZ720 AZ-720 az-720 networking