Create an Azure VPN with PowerShell

I have been really busy with learning more about Microsoft Azure and automation through PowerShell (Azure-Rm). But every time I want to test something I have to rebuild my lab because I delete everything in the end to save costs. One of the first things I always have to do is to create a new virtual network,  virtual network gateway, local gateway and VPN connection. I got tired of creating these by hand so I made a new PowerShell script. I myself use a Sophos UTM firewall and follow the Sophos manual found here to create the connection.  The steps in the manual are now automated in the script. I hope this will help you too when creating VPN connection for Azure. I also included a script to remove the connection to save costs when done.

To run the script you must have the Azure PowerShell module installed. You can do that with the following script. *Requires PowerShell 5.0 or higher.

Install Azure PowerShell Module

Create Azure VPN Script

Remove Azure VPN Script

I hope this was informative. For questions or comments you can always give a reaction in the comment section or contact me: