Microsoft Azure Point-to-Site Connectivity: Simplifying Remote Access
Discover how Point-to-Site connectivity in Microsoft Azure offers an efficient solution for connecting virtual machines within a virtual network to on-premises machines. This guide explains why Point-to-Site is ideal for accessing remote VMs, providing a simpler alternative to traditional endpoint configurations.
Microsoft Azure - Point-to-Site Connectivity
In the last chapter, we learned how to create an endpoint to access a virtual machine, but that process can be quite tedious. If you need to connect a virtual machine within a virtual network to an on-premises machine, point-to-site connectivity is the best solution. This method is highly effective for working with remote virtual machines.
Understanding Point-to-Site Connectivity
Point-to-site connectivity connects your on-premises machine to a virtual network in Azure. You can connect up to 128 on-premises machines to your Azure virtual network using this method. Access to the virtual network is secured with a certificate, which must be installed on each local machine that needs to connect.
Enabling Point-to-Site Connectivity on an Existing Virtual Network
If you already have a virtual network set up in Azure, you can enable point-to-site connectivity through the management portal. Follow these steps:
- Log in to the Azure management portal.
- Click on ‘Networks’ in the left panel, and select the network you wish to work with.
- Click on ‘Configure.’
- Check the ‘Configure Point-to-site connectivity’ checkbox. This allows you to enter the starting IP address and the CIDR (Classless Inter-Domain Routing) block.
- Scroll down and click on ‘Add Gateway Subnet.’
- Enter the Gateway subnet and click ‘Save.’ A message will pop up confirming the changes.
- Click ‘Yes,’ and your point-to-site connectivity is set up.
You will need to create and install a certificate on your local machines to access your virtual network.
Creating a New Virtual Network with Point-to-Site Connectivity
- Click on ‘New’ → ‘Network Services’ → ‘Virtual Network’ → ‘Custom Create.’
- Enter a name for your network, select the location, and click ‘Next.’
- On the next screen, select ‘Configure a point-to-site VPN’ and click ‘Next.’
- Enter the starting IP address and select the CIDR block.
- Enter the Subnet, then click ‘Add Gateway Subnet’ and fill in the required information.
- Your point-to-site connectivity setup is complete.
- Click on the name of your network (e.g., ‘MyNet’).
- Click on ‘Dashboard’ to see the details of your network.
At this point, you’ll notice that the gateway has not been created yet. To proceed, you need to generate a certificate first.
Generating Certificates
The point-to-site VPN in Azure supports only self-signed certificates. Here's how you can create one:
Creating a Certificate
- Visit the Microsoft website or search for ‘Windows SDK for 8.1’ on Google. Download the appropriate SDK for your Windows version.
- Download the required file (it will be saved as an .exe file named sdksetup on your machine).
- Run the file. During the installation, uncheck unnecessary features as shown during the setup process.
- After installation, open Command Prompt as an Administrator.
- Enter the following commands to create a root certificate:
- Next, create a client certificate with the following command:
- Search for ‘mmc’ on your computer and run it.
- Click ‘File’ → ‘Add/Remove Snap-in.’
- In the popup window, select ‘Certificates’ and click ‘Add.’
- Choose ‘My User Account’ and click ‘Finish.’
- Expand ‘Current User’ in the left panel, then ‘Personal,’ and then ‘Certificates.’ You will see the certificates listed here.
- Right-click on the certificate, select ‘All Tasks,’ and then ‘Export.’
- Follow the export wizard, name the certificate, and select a location to save it.
Syntax
cd C:\Program Files (x86)\Windows Kits\8.1\bin\x64
makecert -sky exchange -r -n "CN=MyNet" -pe -a sha1 -len 2048 -ss My
Output
Root certificate "CN=MyNet" created successfully.
Replace ‘MyNet’ with the name of your network in the command.
Syntax
makecert -n "CN=MyNetClient" -pe -sky exchange -m 96 -ss My -in "MyNet" -is my -a sha1
Output
Client certificate "CN=MyNetClient" created successfully.
Uploading the Certificate to Azure
- Log in to the Azure management portal.
- Go to your network, click on ‘Certificates,’ and then ‘Upload Root Certificate.’
- Browse to the location where you saved your certificate, select it, and upload.
Downloading the Client VPN Package
The Client VPN Package allows you to connect to the Azure network from your local machine.
- Go to your network’s dashboard in the Azure management portal.
- Scroll down and locate the download options on the right side of the screen.
- Select the appropriate VPN package and download it to your computer. Run and install the package.
- Windows might warn you about running the file. If this happens, click ‘Run Anyway.’
- Go to ‘Networks’ on your computer, and you will see the VPN connection available (e.g., ‘MyNet’).
- Click on the network and select ‘Connect.’ You will now be connected to your Azure virtual network.