How to create a Point-to-Site VPN connection from your machine to Windows Azure
A guide on how to create a Point-to-Site VPN connection from your machine to Windows Azure and how to connect to your Azure Virtual Machines after the Point-to-Site VPN connection is created.
To allow for creating certificates and scripting I recommended using the following technologies:
- Windows 7 or 8
- Windows Server 2012
- Visual Studio 2012
- PowerShell
Recommend creating one in the root of C: on your local machine.
Options:
- Create manually
- Use Shell script: “MKDIR c:\AzureConnection”
- Use PowerShell: “[IO.Directory]::CreateDirectory(“c:\AzureConnection”)”
CERTIFICATES
You’ll need to create root and client certificates. The root certificate will be uploaded to Windows Azure during Point-to-Site VPN creation and the client certificate will be installed on all machines that will access the P2S connection.
CERTIFICATION CREATION PROCESS
- Open a Visual Studio 2012 command prompt
- Next you’ll need to create a root certificate:
Use the Visual Studio command prompt you opened and copy and paste the following:
- makecert -sky exchange -r -n “CN=Azure-P2S-Root-Cert” -pe -a sha1 -len 2048 –ss My
- Next you’ll need to create a client certificate that will be installed on all machines that will access the P2S connection:
Open the Visual Studio cmd prompt, copy and paste the following:
- makecert.exe -n “CN=Client-VPN-Cert” -pe -sky exchange -m 96 -ss My -in “Azure-P2S-Root-Cert” -is my -a sha1
Now that you have the proper certificates created you’ll need to extract them from the certificate store from the machine where the certificates were created:
- Open an MMC (Microsoft Management Console),
- Click File and select Add/Remove Snap-in…
- Click Certificates and then Add >,
- Keep My user account selected,
- Click Finish then click OK
- Expand Certificates – Current User,
- Expand the Personal folder,
- Click the Certificates folder
EXPORTING ROOT CERTIFICATE
- Right-click on the root certificate you created,
- Select All Tasks,
- Select Export…,
Click Next (you won’t need to private key for the root certificate so select No, do not export the private key if not selected by default):
Keep the default DER encoded binary (.CER) selected and click Next:
Browse to the folder (e.g. c:\AzureConnection) you created in the beginning:
Type a file name and click Save the Finish:
EXPORTING CLIENT CERTIFICATE
Now you’ll need to export the client certificate as a “.PFX”:
- Right-click on the client certificate you created,
- Select All Tasks,
- Select Export…,
- Click Next
This time you will need to export the private key as well.
- Select “Yes, export the private key”
- Make sure “Personal Information Exchange” is selected and that “Include all certificate in the certification path if possible is selected”
- Click Next
- Type in a password (required)
- Click next
- Browse to the folder (e.g. AzureConnection) you created in the beginning:
- Type in a file name and click Save then Finish:
ADD CLIENT CERTIFICATES TO MACHINES THAT WILL ACCESS THE P2S VPN CONNECTION
- Now that you have both certificates created it’s time to install the client certificate on machines that will need access to the Windows Azure Point-to-Site VPN connection. Do this by copying the client certificate to the machine(s) you will allow to access the P2S VPN connection.
- Once the client certificate is copied navigate to the folder the client certificate was saved in, right-click on the client certificate, and select Install PFX:
REATING A Point-to-Site VPN CONNECTION IN WINDOWS AZURE
- Navigate to http://manage.windowsazure.com/ and either log into your account or sign up for a trial account.
- Once you’re logged into Windows Azure you’ll see a variety of options on the left hand navigation. Go ahead and select NETWORKS from the list:
- Select +NEW at the bottom left hand corner:
- Select VIRTUAL NETWORK and then CUSTOM CREATE:
- Under Virtual Network Details type in a name for your virtual network and either create a new affinity group or use an existing one. If you create a new affinity group you’ll need to type in a name as I have below:
- Click the arrow below to move to the next step:
- Click the arrow below to move to the next step:
- Select “Configure point-to-site VPN” and click the arrow below.
If you’d like DNS name resolution from your DNS servers, you’ll have to add your own DNS servers to the fields provided.
DNS Servers
This setting is optional. You can add DNS servers to your virtual network for name resolution. If you want to have name resolution between this virtual network and your on-premises network, you should specify the DNS servers that are used for your on-premises name resolution. You can also specify public DNS servers. If you do not specify a DNS server, name resolution will be provided by Windows Azure.
Quick Tip
Use the IP addresses from the Azure virtual machines (I’ll show you how to do this toward the end) and add local entries to the \etc.\hosts file to provide name resolution.
- Click the arrow below to move to the next step:
- Configure an address space or use the default:
- Click the arrow below to move to the next step:
- Click “add gateway subnet” and either leave default entry or modify:
- Click the check mark to complete (setting up the network connection will take a few minutes to complete).
UPLOADING THE ROOT CERTIFICATE
Once the Point-2-Site network is created click on the new instance and select certificates:
Remember that root certificate you created and exported in the beginning? Well now is the time to upload it to Azure.
- Select UPLOAD at the bottom of the screen
- Browse to the folder created in the beginning (e.g. c:\AzureConnection)
- Select the root certificate you created and click the check to upload:
Once the root certificate is created you’re ready to establish a Point-to-Site VPN connection from your local machine to Windows Azure.
INSTALLING THE Point-to-Site VPN Connection on your machine(s)
NOTE: Make sure the client certificate is installed on any machine establishing the P2S VPN connection.
- First you’ll need to log into Windows Azure and download the preconfigured VPN client (clients are offered in 32 bit and 64 bit)
- From the right menu select NETWORKS and then select the VPN instance you want to work with.
- Under “quick glance” you’ll see two client VPN download options:
- Choose a package and download
- Once the package is downloaded copy it to the machine(s) you’d like to establish a Point-to-Site VPN connections and double click to install.
ESTABLISHING THE Point-to-Site VPN Connection
For this step I’m using Windows 8
- Click on the networking icon on the task bar: and choose the name of the Point-to-Site VPN connection you installed and click connect (mine is shown below):
- Click Connect on the dialog box:
- Click Continue:
You’ve established a Point-to-Site VPN connection from your local machine to Windows Azure!
ACCESSING AZURE RESOURCES
Accessing Virtual Machines from a Point-to-Site VPN connection
- To access Virtual Machines, the VMs will need to be associated with the affinity group you created when you created the Point-to-Site VPN connection. To look up the affinity group from Window Azure, navigate to NETWORKS and select the VPN connection you created.
- IMPORTANT NOTE regarding existing virtual machines:
- As of the current release you must create new VMs and attach to the VPN affinity group during the Azure VM setup process. Attaching pre-created VMs to a new affinity group is not supported at this time. If you already have VMs created, save the VM disk(s) and recreate the VM using the saved VM disk and add it to the VPN affinity group during the Azure VM setup process.
- Click DASHBOARD
- Under “quick glance” look for the AFFINITY GROUP name.
Once a virtual machine is part of the Point-to-Site VPN connections affinity group you’ll need to look up the IP address of the Azure VM to access if from your local machine or modify the etc/host file for rudimentary name resolution (of a DNS sever wasn’t defined).
How to find out what the IP address is for a Windows Azure Virtual Machine
- Log into Windows Azure
- From the menu on the right select VIRTUAL MACHINES
- Select a Virtual Machine
- Click DASHBOARD
- Under “quick glance” look for the INTERNAL IP ADDRESS
The walk-though of creating a Point-to-Site VPN connection with Windows Azure is now done.
Disclaimer: Many of the articles are taken from MSDN, Azure tutorials and other sources on internet to provide a single place for various information about azure development.No copyright on this information is claimed and the copyright of all information is acrrued to all original authors including MSDN and Microsoft azure training materials.Some of this information shall be outdated or incorrect and the authenticty of the information contained should be verified with changes in azure or your own environment. We do not recommend using any of this information without proper consultation.