Hi there
In this article we’re gonna explore how to create an Azure Point-to-Site VPN for Remote Access
Connect to your Azure virtual networks from anywhere
Point-to-Site VPN allows you to connect to your virtual machines on Azure virtual networks from anywhere.
- Connect to your Azure Subscription https://portal.azure.com
Prerequisites
- Under your Resource Group
- Create your VNET (Virtual Network)
- Create at least 02 subnets on your VNET
- Address Space (IP: 10.120.0.0/16)
-
- Frontend subnet (IP: 10.120.1.0/24)
- Gateway subnet (IP: 10.120.255.0/24)
-
- Address Space (IP: 10.120.0.0/16)
Virtual Network Gateway Setup
- Create a Virtual Network Gateway resource object
-
-
- Name: Virtual network gateway
- SKU: basic
- Public IP address: define a static one (create a new one)
- Resource Group: pick your default resource group where your VMs are being hosted.
-
-
- After your Virtual Network Gateway is created go to this resource and check the following information (should be empty)
-
- select Point-to-site configuration
- configure
-
Address pool:
- Tunnel type:
- Authentication type:
- Root certificates:
- Name
- Public certificate data
- Revoked certificates
- Name
- Thumbprint
-
- Allocated IP addresses
-
- Setup the Virtual Network Gateway SSl Root Cert and Child Cert using self-signed certificate
- Create a self-signed root certificate
Open PowerShell as an Administrator and run the following script#Root Certificate $date_now = Get-Date $extended_date = $date_now.AddYears(10) $cert = New-SelfSignedCertificate -Type Custom -KeySpec Signature ` -Subject āCN=2020P2SRootCertā -KeyExportPolicy Exportable ` -HashAlgorithm sha256 -KeyLength 2048 ` -CertStoreLocation āCert:\CurrentUser\Myā -KeyUsageProperty Sign -KeyUsage CertSign -Notafter $extended_date
This will create root cert and install it under current user cert store valid for 10 years. - Generate a client certificate
Open PowerShell as an Administrator and run the following command:#Client Certificate New-SelfSignedCertificate -Type Custom -DnsName 2020P2SChildCert -KeySpec Signature ` -Subject āCN=2020P2SChildCertā -KeyExportPolicy Exportable ` -HashAlgorithm sha256 -KeyLength 2048 ` -CertStoreLocation āCert:\CurrentUser\Myā ` -Signer $cert -TextExtension @(ā2.5.29.37={text}1.3.6.1.5.5.7.3.2ā) -Notafter $extended_date
Get-ChildItem -Path "Cert:\CurrentUser\My\" | select issuer,subject,thumbprint | where-object { $_.subject -like "*2020*"}
- Export the root certificate public key (.cer)
#Export SSL Cert to PFX $mypwd = ConvertTo-SecureString -String "P@ssw0rd" -Force -AsPlainText Get-ChildItem -Path Cert:\CurrentUser\My\93B0F586E79C3003C02B70FCCA32F361207A19AE | Export-PfxCertificate -FilePath 2020SslChildCert.pfx -Password $mypwd #client Get-ChildItem -Path Cert:\CurrentUser\My\180D81C8631257C13880327AE028DAB90CB6861C | Export-PfxCertificate -FilePath 2020SslRootCert.pfx -Password $mypwd #root
- Export the client certificate
Tip: change the ROOT and Client certificate Expire dates to 5, 10 or 15 years otherwise you’ll have to regenerate them again in 1 year (default option)
- Create a self-signed root certificate
- Setup the Virtual Network Gateway
- select Point-to-site configuration
- Click on the newly created VPN gateway connection.
- Then in a new window click on Point-to-site configuration
- Click onĀ Configure Now
- In new window type IP address range for VPN address pool. In this demo, I will be using 10.120.100.0/24. For tunnel, type use bothĀ SSTP & IKEv2. Linux and other mobile clients by default use IKEv2 to connect. Windows also useĀ IKEv2Ā first and then tryĀ SSTP. For authentication type useĀ Azure Certificates.
- In the same window, there is a place to define a root certificate. Under root certificate name type the cert name and under public certificate data, paste the root certificate data ( you can open cert in notepad to get data).
- Then click onĀ SaveĀ to complete the process.
Note: when you paste certificate data, do not copy āāBEGIN CERTIFICATEāā & āāEND CERTIFICATEāā text
- select Point-to-site configuration
- Testing VPN connection (quick
- Log in to Azure portal from the machine and go to VPN gateway config page.
- On that page, click onĀ Point-to-site configuration.
- After that, click onĀ Download VPN client.
References
https://docs.microsoft.com/en-us/azure/vpn-gateway/vpn-gateway-howto-point-to-site-resource-manager-portal
https://docs.microsoft.com/en-us/azure/vpn-gateway/vpn-gateway-certificates-point-to-site
https://docs.microsoft.com/en-us/azure/vpn-gateway/point-to-site-how-to-vpn-client-install-azure-cert