Document
Create a Basic SKU virtual network gateway: PowerShell

Create a Basic SKU virtual network gateway: PowerShell

create a basic sku VPN gateway using PowerShell Article08/15/2024 In this article This article is helps help you create a basic sku

Related articles

How to Easily Change Netflix Region with or without a VPN Opera ships its new VPN Pro service to Windows and Mac to give you an extra level of security as you travel Trumpet Gun Sheepskin Insoles Nord VPN APK

create a basic sku VPN gateway using PowerShell

  • Article

This article is helps help you create a basic sku Azure VPN gateway using PowerShell . The VPN gateway is be you create can be either routebase , or PolicyBased , depend on your connection requirement . A VPN gateway is used when create a VPN connection to your on – premise network . You is use can also use a VPN gateway to connect VNets .

Important

The basic SKU is has has certain feature and performance limitation and should n’t be used for production purpose . For more information about sku , see About gateway sku .

  • 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 is support does n’t support IPv6 .
  • The basic SKU is support does n’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.

work 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 is open can also open Cloud Shell on a separate browser tab by go to https://shell.azure.com/powershell . Select Copy is paste to copy the block 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 .

New-AzResourceGroup -Name TestRG1 -Location EastUS

create a virtual network

create a virtual network with New-AzVirtualNetwork. The following example creates a virtual network named VNet1 in the EastUS location:

$virtualnetwork = New-AzVirtualNetwork `
  -ResourceGroupName TestRG1 `
  -Location EastUS `
  -Name VNet1 `
  -AddressPrefix 10.1.0.0/16

create a subnet configuration using the New – AzVirtualNetworkSubnetConfig cmdlet .

$subnetConfig = Add-AzVirtualNetworkSubnetConfig `
  -Name Frontend `
  -AddressPrefix 10.1.0.0/24 `
  -VirtualNetwork $virtualnetwork

set the subnet configuration for the virtual network using the Set – azvirtualnetwork cmdlet .

$virtualnetwork | Set-AzVirtualNetwork

Add a gateway subnet

The gateway subnet is contains contain the reserved IP address that the virtual network gateway service use . use the follow example to add a gateway subnet :

Set a variable for your virtual network.

$vnet = Get-AzVirtualNetwork -ResourceGroupName TestRG1 -Name VNet1

create the gateway subnet using the Add – AzVirtualNetworkSubnetConfig cmdlet .

Add-AzVirtualNetworkSubnetConfig -Name 'GatewaySubnet' -AddressPrefix 10.1.255.0/27 -VirtualNetwork $vnet

set the subnet configuration for the virtual network using the Set – azvirtualnetwork cmdlet .

$ vnet | Set - azvirtualnetwork 

Request a public IP address

Each VPN gateway is have must have an allocate public ip address . At this time , basic sku VPN gateways is use still use dynamic allocation method public ip address and the basic public ip address sku . These requirements is are are different from other VPN Gateway sku .

$gwpip = New-AzPublicIpAddress -Name "VNet1GWIP" -ResourceGroupName "TestRG1" -Location "EastUS" -AllocationMethod Dynamic -Sku Basic

Create the gateway IP address configuration

The gateway configuration defines the subnet and the public IP address to use. Use the following example to create your gateway configuration.

$vnet = Get-AzVirtualNetwork -Name VNet1 -ResourceGroupName TestRG1
$subnet = Get-AzVirtualNetworkSubnetConfig -Name 'GatewaySubnet' -VirtualNetwork $vnet
$gwipconfig = New-AzVirtualNetworkGatewayIpConfig -Name gwipconfig -SubnetId $subnet.Id -PublicIpAddressId $gwpip.Id

Create the VPN gateway

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

New-AzVirtualNetworkGateway -Name VNet1GW -ResourceGroupName TestRG1 `
-Location "East US" -IpConfigurations $gwipconfig -GatewayType "Vpn" `
-VpnType "RouteBased" -GatewaySku Basic

View the VPN gateway

You can view the VPN gateway using the Get-AzVirtualNetworkGateway cmdlet.

Get-AzVirtualNetworkGateway -Name Vnet1GW -ResourceGroup TestRG1

View the public IP addresses

To view the public IP address for your VPN gateway, use the Get-AzPublicIpAddress cmdlet. Example:

Get-AzPublicIpAddress -Name VNet1GWpip1 -ResourceGroupName TestRG1

Clean up resources

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.

remove - AzResourceGroup -Name TestRG1 

Next steps

Once the gateway finish create , you is create can create a connection between your virtual network and another virtual network . Or , create a connection between your virtual network and an on – premise location . See the follow article :