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

Removing Azure Active Directory users using Azure ... Cloud Shell is one of the new features in Azure Portal, and it is accessible from virtually any browser and even from Azure App. In this Tutorial, we ...
Azure Backup – Part 3 – Backup Virtual Machines... On the first post (see here), I explained how the Azure backup works. On this post, I’m explaining how to backup Virtual Machines with Azure Backup. ...
How to rename an AWS EC2 instance during provision... In the Cloud era the VM/instance name is not that important, especially when we have a fleet of servers doing the same work, and that is key for scena...
Performing daily task with PowerShell to manage Hy... As a virtualization administrator, you will come across a lot of scenarios where you will need to create, modify, move, export, and other tasks to man...