Having used Microsoft’s cloud computing platform ‘Azure’ in the past to create and configure Windows servers, I thought it would be a good platform to host a Linux server to experiment with ASP.NET 5 on Linux as it’s easy to get a virtual machine (VM) up and running in a few minutes.
When creating a Linux VM on Azure, there are a number of vendor packages to choose from such as openSUSE, Oracle and Ubuntu. I decided on a recommended VM image called Ubuntu 14.04 LTS. The LTS stands for ‘Lerm Term Support’ which means patches and support will be available until 17th April 2019.
Creating a new VM using the Azure portal is straightforward and I prefer using the new Azure management portal at https://portal.azure.com. Click on the NEW icon and select compute, then Ubuntu Server 14.04 LTS.
Next you’ll be asked to fill out some basic details such as the server name and size (I selected the Standard A0 size to start off with which has a 0.25 compute core with 0.75gb RAM costing about £9 a month. The VM size can be changed at a later date too, so you won’t need to recreate it if you need more power!)
You’ll also be asked to provide a username and either a password or SSH public key to log into the server once it’s been provisioned. SSH stands for Secure Shell and allows a user to remotely login into the machine using a secure and encrypted connection. Using an SSH public key is much more secure than a password so I left the password field blank and created a SSH public key using a program called Bitvise, a SSH client for Windows. To do this, install and open Bitvise, click on the Client key manager link and generate a new Client key. I set the algorithm to RSA and the size to 2048. You’ll then want to export the public key using the OpenSSH format. Copy and paste the entire contents of the export file into the public SSH key field in Azure.
Once you’ve configured your VM, click on create and Azure will provision your new Linux virtual machine! Easy!
The next thing to do is to test that you can log into it. Using the Bitvise SSH client, set the host to the DNS name that Azure assigned to the VM (click on the virtual machine in Azure to locate this) and set the port to the public port for the SSH endpoint which can be found in settings, endpoints. The public port will map to a private SSH port 22 on the VM.
Enter your username in the authentication panel on Bitvise and set the initial method to “public key”. You then need to select the Client key that you generated earlier. If you secured this with a passphrase when you initially created it, enter that too. Then click on “Login”. You should now be connected to your new Linux virtual machine in Azure!