Home Setting Up Point-To-Site Virtual Gateway – Azure
Post
Cancel

Setting Up Point-To-Site Virtual Gateway – Azure

Azure is an interesting platform, and I wanted to see what it is like to connect a device on my private network to Azure's Private network, if for example I was to set up replication, or Azure Backup etc.

Below is the steps that I took to get it up and running on my Hyper-V 2019 host.

  1. On the Virtual Network, created separate gateway subnet to attach the Virtual Gateway to.

image

2. Head to the Virtual Network Gateway you created, then click Point-to-site configuration. Add a IP range that the site will connect to.

image

3. On the client ie. My Hyper-V host, need to run the below in a elevated Powershell prompt. NOTE Don't close the Powershell prompt

$cert = New-SelfSignedCertificate -Type Custom -KeySpec Signature ` -Subject "CN=AzureVPN" -KeyExportPolicy Exportable ` -HashAlgorithm sha256 -KeyLength 2048 ` -CertStoreLocation "Cert:\CurrentUser\My" -KeyUsageProperty Sign -KeyUsage CertSign

This will create the cert you can use for the VPN.
Now to create the Client cert run the below.

New-SelfSignedCertificate -Type Custom -DnsName P2SChildCert -KeySpec Signature ` -Subject "CN=AzureVPNClient" -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")

image

Once you can see the cert in Current User -> Persoanl -> Cetificates, right click on the AzureVPN certificate, and go All Tasks -> Export.

image image

Export it where ever is easiest for you, IE Desktop.
Now open the certificate in Notepad

image

Copy all of the certificate and head back to the virtual gateway on the Azure Portal.
You will need to enter as below, except pasting your own certificate.

image

Make sure to save this configuration, and do note this can take some time.
Once the configuration is saved, click Download VPN client. Extract the zip. Once you have extracted the ZIP head to "WindowsAmd64/VpnClientSetupAmd64.exe" and run.
Click Yes to installing the VPN Client.
If you check in Network Adapters, you will see a WAN Miniport connection. Click connect and you will be prompted with this.

image

Click Connect again and you will be connected to your Virtual Network hosted in Azure!

We can confirm this by first trying to RDP into my virtual machine that is hosted in Azure.
As you can see, my VM in Azure has a private IP 10.0.0.4

image image

And there we go, we are now connected our Azure Virtual Network from our Hyper-V host!

This post is licensed under CC BY 4.0 by the author.