How to Create Virtual Machine and Install OpenVPN on Microsoft Azure

Azure is a powerful cloud computing platform created by Microsoft. It provides various services and solutions including Web apps, virtual machines, SQL database and so forth. I’m interested in virtual machine service and have been experiencing it for a few days. During my work time, I often need to switch platforms among Windows, Mac OS X, and Linux. VMWare Workstation is an excellent software for running different operating systems, but it costs CPU, Memory and disk storage.

How to Create Virtual Machines on Microsoft Azure

Visit https://azure.microsoft.com. You can try Azure for free and get $250 credits.

Azure for free Azure does not support Mac OS virtual machine.

Click Portal to login to the dashboard. At the bottom, click NEW > COMPUTE > VIRTUAL MACHINE to create a VM.

Azure Virtual Machine

You can select FROM GALLERY to choose more images.

Azure VM Images

When creating a virtual machine, you can specify CPU and memory. It’s amazing.

Virtual Machine Size

We can also set the region of the virtual network.

Virtual Machine Network

Note: if select QUICK CREATE and choose Linux, the username is azureuser by default.

How to login to Windows VM or Linux VM on Azure?

If you create a Windows virtual machine, click CONNECT and download a .rdp file.

Virtual Machine Connection

Double-click the RDP file to run Remote Desktop Connection.

If you create a Linux virtual machine, launch putty and specify the host name. And then click open to login.

putty SSH

How to Setting Up OpenVPN on Linux Virtual Machines

A virtual private network (VPN) is useful for remote work. How can we set up a VPN on the virtual machine that located on Microsoft Azure?  I followed the article - OpenVPN on Windows Azure – to build my own VPN server.

Here are the steps:

  1. Create virtual machine endpoints on Azure. Azure endpoints
    • HTTPS: TCP 443
    • AdminUI: TCP 943
    • OpenVPN Server: UDP 1194
  2. Install OpenVPN on Linux and set OpenVPN password. Download:

     wget -c http://swupdate.openvpn.org/as/openvpn-as-2.0-Ubuntu13.amd _64.deb
    

    Install:

     sudo dpkg -i openvpn-as-2.0-Ubuntu13.amd _64.deb
    

    Set Password:

     sudo passwd openvpn
    

    Install OpenVPN on Ubuntu

  3. Login OpenVPN administration page, change server name and user permissions.

OpenVPN admin

OpenVPN Server Settings

The hostname is which I used to login Linux.

OpenVPN User Permissions

The username is which I used to login Linux.

  1. After finishing the configuration, login OpenVPN user page. You have two options for VPN connection: either download OpenVPN Connect or download connection settings (.ovpn file).

OpenVPN User Login

OpenVPN Connect download

  1. Run OpenVPN Connect or OpenVPN client.
    • OpenVPN Connect has configured everything for VPN connection. You just need to directly run the exe file.
    • Alternatively, if you want to use OpenVPN client, copy the .ovpn file to ** \config** and then run OpenVPN GUI.
  2. Finally, we can see the connection status. OpenVPN Warning OpenVPN Connected