

$p2srootcert = New-AzureRmVpnClientRootCertificate -Name $P2SRootCertName -PublicCertData $MyP2SRootCertPubKeyBase64 # Generate and upload certificates: for doing this follow the instruction after this code and copy the public key of the generated certificate here $ipconf = New-AzureRmVirtualNetworkGatewayIpConfig -Name $GWIPconfName -Subnet $subnet -PublicIpAddress $pip $pip = New-AzureRmPublicIpAddress -Name $GWIPName -ResourceGroupName $RG -Location $Location -AllocationMethod Dynamic You will later connect the gateway to the gateway IP configuration This IP address is necessary for the gateway to work properly.

#Request a dynamically assigned public IP address. $subnet = Get-AzureRmVirtualNetworkSubnetConfig -Name "GatewaySubnet" -VirtualNetwork $vnet $vnet = Get-AzureRmVirtualNetwork -Name $VNetName -ResourceGroupName $RG #Specify the variables for the virtual network you just created. New-AzureRmVirtualNetwork -Name $VNetName -ResourceGroupName $RG -Location $Location -AddressPrefix $VNetPrefix1,$VNetPrefix2 -Subnet $fesub, $besub, $gwsub -DnsServer $DNS $gwsub = New-AzureRmVirtualNetworkSubnetConfig -Name $GWSubName -AddressPrefix $GWSubPrefix $besub = New-AzureRmVirtualNetworkSubnetConfig -Name $BESubName -AddressPrefix $BESubPrefix $fesub = New-AzureRmVirtualNetworkSubnetConfig -Name $FESubName -AddressPrefix $FESubPrefix #Create a front-end, gateway and backend subnet New-AzureRmResourceGroup -Name $RG -Location $Location Select-AzureRmSubscription -SubscriptionName "Your Subscription Name" Below I provided commands for PowerShell. You can do this using PowerShell or Azure portal. First You need to create your VNet and VPN gateway in Azure.
