Provision Your Virtual Machine (Azure)

This is step 3 of 7 of Hands-On Project 1 for Azure. In this step, you create a virtual machine and learn to access it using SSH. As part of the process, you will create an SSH key pair on your Windows computer, and also become familiar with a good SSH client program for Windows called Bitvise.

Back to Project

To get one example of provisioning a virtual machine on Azure, let’s start with this 6 minute video tutorial:

Create an SSH Key Pair

You can create an SSH Key Pair within Azure as part of the virtual machine setup process. However, we are going to do it a different way by creating an SSH key pair on our client computer. By doing it this way, you can add a passphrase to the private key. As of this writing, the Azure virtual machine setup page does not allow you to add a passphrase, and this makes your key less secure. Create an SSH key pair for your virtual machine using these instructions:

Creating an SSH Key Pair Using ssh-keygen

Create your Virtual Machine

Let’s create a virtual machine, and provide the public SSH key you just created as part of the set up:

  1. From the Azure Portal, please do the following:
  2. Navigate: Portal Home –> Virtual Machines –> Create.
  3. Subscription and Resource Group: Select the resource group you are using for all of these exercises.
  4. Enter a virtual machine name. These names must follow certain rules. Enter a name with a blank in it and the web page will display these rules to you.
  5. Select a Region. If you are using an Azure for Students account, you might be limited to create your VM only in certain regions. At the time of this writing, creating a VM from the USA midwest, the closest region allowed for Azure for Students accounts is US West 3. If you are using a standard Azure account, select the region that is closest to you geographically.
  6. Allow Availability Options, Availability Zone and Security Type to default.
  7. For Image, select Ubuntu Server 20.04 LTS. We will be assuming Ubuntu 20.04 server in future exercises.
  8. Skip down to Size and select the least expensive size option. as of this writing, the least expensive option for Azure for Students accounts is Standard_D2s_v3, which costs $70.08 per month, or about 10 cents per hour. If you are using a standard account, choose the Standard B1s size – we won’t need much power for this particular virtual machine. Standard B1s costs about $5 per month.
  9. For Administrator Account, select SSH public key. For user name, you can enter a name, but if you will be following these exercises for AWS, you may want to use ‘ubuntu’ as your account name. (The AWS VM setup uses this name and does not give you the option to change it at setup time.)
  10. For SSH public key source, select use existing public key. Open your SSH public key file (with .pub extension), copy the complete contents of the file and paste it into SSH public key.
  11. For inbound port rules, leave the default settings. For convenience, we will be opening TCP port 22 to the public internet so that we can access it from any IP address. This is less secure than limiting the IP address range, but if the public IP address of your network uses DHCP, this will save you the trouble of updating the firewall rule every few days to adjust to new DHCP leases. Note that using this approach, you will receive continuous warnings from Azure that your VM is not entirely secure. For our purposes, you can ignore these warnings.
  12. You can click through the Disks tab. We will be taking all the defaults. Explore the options there if you’d like.
  13. Click Next: Networking. On this tab, we need to provide details for the network that this virtual machine will reside on. If this is your first virtual machine, Azure will suggest a new virtual network (VNET), subnet, and public IP address name. If you already have a VNET and subnet, you can and should select your existing names. You will need a new public IP address for this VM. Naming the IP address the same as the virtual machine name helps you to keep track of which IP address is used with which VM.
  14. Scroll down and select Delete public IP and NIC when VM is deleted. IP addresses and network interface cards are normally dedicated to a single VM. By choosing this, the NIC and IP address will be deleted when you delete the VM. This avoids having “orphan” resources cluttering up your Portal.
  15. You can click through the Management, Monitoring, Advanced and Tags tabs to explore the options available. We will be taking all the defaults. Or you can click on Review and Create to skip these tabs.
  16. Click Create. Azure will begin the provisioning process, and tell you when it is complete.
  17. After deployment is complete, click on Go To Resource. Click through the resource pages for your VM and confirm that you can find VM name and status, OS, size, public IP address, VNet, Subnet and private IP address.

Connect to Your Virtual Machine Using Bitvise SSH Client

Follow these instructions to get connected to your virtual machine with the Bitvise client:

Install and Prepare Bitvise SSH Client

Once connected, copy some files to the VM and get comfortable with using your SFTP client to move things back and forth.