Script to create a VPN Site-to-Site using Azure Resource Manager

Share this:

The process to create a VPN Site-to-Site in Microsoft Azure requires a series of cmdlets, and at this time the administrator cannot use Azure Preview Portal for that purpose.

Solution


We created the VPN site-to-site using Azure Resource Manager on this Tutorial http://itprocentral.com/how-to-create-a-virtual-network-using-azure-resource-manager-arm/ and we used the following diagram to help understanding the concepts behind of all cmdlets involved in the process.

 

image

After creating that Tutorial, we decided to create a simple script to automate the process, and we called it AZFast-VPN-s2s.ps1 and it can be download from here.

Defining the variables…

During the process, some items are repeated several times and since it is not a task that most of administrators do every week, then we have some room for mistakes. In our script we are grouping the settings at the begging of the script and the administrator just need to fill out the information. We divided in two sections: Azure and On-Premises, as shown in the figure below.

The script below contains the same information of the diagram, this way you can use that to compare and change based on your environment.

image

Running the script..

The first step is connect on Microsoft Azure using Microsoft Azure PowerShell, and we explain the process on this following Tutorial:  http://itprocentral.com/?p=13141 and after that the script can be run by just typing its name .\AZFastVPN-s2s.ps1 as shown in the image below.

image

The process will take a while, and at the end we will provide the information that you can copy and paste in an e-mail to your administrator containing three key pieces of information to complete the setup which are: Shared Key, Azure VPN IP and some examples how to configure your existent firewall.

image

Please feel free to change the script to fit your requirements. If you find a better way to automate, please drop us a comment.

Written by Anderson Patricio

Anderson Patricio

Anderson Patricio is a Canadian MVP in Cloud and Datacenter Management, and Office Server and Services, besides the Microsoft Award he also holds a Solutions Master (MCSM) in Exchange and several other certifications. Anderson has been contributing to the Microsoft Community with articles, tutorials, blog posts, twitter, forums and book reviews. He is a regular contributor here at ITPROCentral.com, MSExchange.org, Techgenix.com and Anderson Patricio.org (Portuguese).

Related Post

MPIO on Hyper-V Server On the previous version of Windows Server (prior Windows Server 2012) you have to download and install MultiPath I/O (MPIO). Since Windows Server 2012...
How to configure Azure Logic Apps Usually for social media automation I used for a long time IFTTT, although with Azure Logic Apps I decide to give a try. I started to use Azure Logic ...
Statistics of a NIC Teaming If the UI window is sufficiently tall a statistics tile appears at the bottom of the Team tile and the Adapters and Interfaces tile. These statistics ...
Azure Virtual Network Service Azure virtual network is the networking service that lets everyone create and manage virtual private networks in Microsoft Azure and securely link the...