Create Point-To-Site on existing VNET

**Note:** Please fill all script parameters.

Scenario

You want to provision Point-To-Site (ARM) to able to connect from anywhere such as Home or when few clients need data from your network.

Requirements

Script Content

The content of the script is reproduced below  

PowerShell
Edit|Remove
##Script Parameters## 
#Resource Group Name 
$RGName = <ResourceGroup Name>; 
#Azure Region 
$Location = <Azure Location>; 
#Azure VNET Name 
$VNetName = <VNet Name>; 
#Gateway Subnet Name – 'GatewaySubnet' is mandatory for the gateway to work (please do not change this name) 
$SubnetGWName = "GatewaySubnet" 
#Gateway Subnet Range 
$SubnetGWRange = <Gateway Range>; 
#Root Cert Name 
$RootCertName = <RootCert Name>; 
#Key of Root Self-Sigend Certficate Base64 format 
$RootCertKey = <RootCert Key Base64>; 
#Gateway Name 
$GatewayName = <Gateway Name>; 
#Gateway PublicIP Name 
$GatewayPIPName = <Gateway Pubic IP Name>; 
#VPN Client Pool Range (Point-To-Site Pool) 
$VPNClientPool = <VPN Client Pool Range>; 
 
##MAIN## 
 
#Create Azure VPN Root Cert "Upload the Root Cert" 
$AZRRootCert = New-AzureRmVpnClientRootCertificate -Name:$RootCertName -PublicCertData:$RootCertKey; 
 
#Get VNET Configuration 
$VNet = Get-AzureRmVirtualNetwork -Name:$VNetName -ResourceGroupName:$RGName#Get Gateway Subnet VNET Configuration 
$SubnetGateway = Get-AzureRmVirtualNetworkSubnetConfig -Name:$SubnetGWName -VirtualNetwork:$VNET -ErrorAction:SilentlyContinue; 
if ($SubnetGateway -eq $null) { 
    Add-AzureRmVirtualNetworkSubnetConfig -Name:$SubnetGWName -VirtualNetwork:$VNet -AddressPrefix:$SubnetRGRange; 
    Set-AzureRmVirtualNetwork -VirtualNetwork:$VNet; 
} 
 
#Create Public IP 
$PublicIP = New-AzureRmPublicIpAddress -Name $GatewayPIPName -AllocationMethod:"Dynamic" -ResourceGroupName:$RGName -Location:$Location#Create Gateway Configuration 
$GatewayConf = New-AzureRmVirtualNetworkGatewayIpConfig -Name:"GWConf" -Subnet:$SubnetGateway -PublicIpAddress:$PublicIP; 
 
#Create Gateway using Gateway Configuration and Point-To-Site Configuration 
New-AzureRmVirtualNetworkGateway -Name:$GatewayName -IpConfigurations:$GatewayConf -GatewayType:Vpn -VpnType:RouteBased -EnableBgp:$false -GatewaySku:Standard -VpnClientAddressPool:$VPNClientPool -VpnClientRootCertificates:$AZRRootCert -ResourceGroupName:$RGName -Location:$Location; 
 
#Get Azure VPN Client Package 
Get-AzureRmVpnClientPackage -ResourceGroupName -VirtualNetworkGatewayName:$GatewayName -ProcessorArchitecture:"Amd64" -ResourceGroupName:$RGName;