How to create Basic Azure VPN Gateway

arslakwij200 20 Reputation points
2024-03-15T19:43:41.3166667+00:00

Hello,

I'm trying to create a Basic SKU of a VPN gateway. I know that it needs to be created from the CLI and not from the web portal so I tried to do it but so far have failed. I have created a VPN tunnel using VpnGW1 but it's too expensive for us so I deleted the gateway. All other resources required for the VPN are already there. Any help would be greatly appreciated. Thanks.

Azure VPN Gateway
Azure VPN Gateway
An Azure service that enables the connection of on-premises networks to Azure through site-to-site virtual private networks.
1,461 questions
Azure
Azure
A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.
1,089 questions
0 comments No comments
{count} votes

Accepted answer
  1. TP 83,971 Reputation points
    2024-03-15T19:46:20.9266667+00:00

    Hi,

    Please see sample code below. You can copy/paste it into PowerShell Azure Cloud Shell:

    $location = "westus3"
    $resourceGroup = "basic-vnet-gateway-group"
    $vnetAddressSpace = "10.20.0.0/16"
    $gatewaySubnet = "10.20.0.0/27"
    New-AzResourceGroup -Name $resourceGroup -Location $location
    $subnetConfig = New-AzVirtualNetworkSubnetConfig -Name GatewaySubnet -AddressPrefix $gatewaySubnet
    $vngwPIP = New-AzPublicIpAddress -Name myvngw-ip -ResourceGroupName $resourceGroup -Location $location -Sku Basic -AllocationMethod Dynamic
    $vnet = New-AzVirtualNetwork -Name myvngw-vnet -ResourceGroupName $resourceGroup -Location $location -AddressPrefix $vnetAddressSpace -Subnet $subnetConfig
    $subnet = Get-AzVirtualNetworkSubnetConfig -Name GatewaySubnet -VirtualNetwork $vnet
    $vngwIpConfig = New-AzVirtualNetworkGatewayIpConfig -Name vngwipconfig -SubnetId $subnet.Id -PublicIpAddressId $vngwPIP.Id
    New-AzVirtualNetworkGateway -Name myvngw-gw -ResourceGroupName $resourceGroup -Location $location -IpConfigurations $vngwIpConfig -GatewayType Vpn -VpnType RouteBased -GatewaySku Basic
    
    

    Please click Accept Answer and upvote if above was helpful.

    Thanks.

    -TP


0 additional answers

Sort by: Most helpful