Azure VM

by Gisle Hannemyr

This chapter describes how to set up a cloud server VM on the Microsoft Azure cloud service, and how to use specific tools (such as the portal) provided by Microsoft Azure.

Table of contents

Introduction

This document is part of the internal documentation for Hannemyr Nye Medier AS. Its main audience is staff helping clients to set up managed hosting for Drupal on IaaS provided by Microsoft Azure. It is not read-protetected by choice. We are a transparent company and also want our clients and others to have public access to this information.

Microsoft Azure is Microsoft's public cloud computing platform. It provides a range of cloud services, including compute, analytics, storage and networking. Users can pick and choose from these services to develop and scale new applications, or run existing applications in the public cloud.

This chapter describes to select, set up, and interact with a virtual machine (VM), set up as a web host, on the platform.

noteAt the present (august 2020), Azure does not provide Ubuntu 20.04 LTS VMs (only Ubuntu 18.04 LTS). My preferred platform for Ubuntu 20.04 LTS is DigitalOcean (YMMV). However, if a client insists on their site being hosted on Azure, they get it. Here are my corresponding page about setting up a DigitalOcean Droplet.

Information for clients who want their data in Norway:.

Requirements

As of June 2020, Microsoft do not yet offer Ubuntu 20.04 LTS. The version they offer is Ubuntu 18.04 LTS. For Drupal 8, the instance type named “Standard_B1ms” seems adequate for the type of simple Drupal site I usually create.

$ lsb_release -a 
No LSB modules are available
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.4 LTS
Release:        18.04
Codename:       bionic
$ grep MemTotal /proc/meminfo 
MemTotal:       1 941 712 kB
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            931M     0  931M   0% /dev
tmpfs           1990  660K  189M   1% /run
/dev/sdb1        29G  1.5G   28G   5% /
tmpfs           949M     0  949M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           949M     0  949M   0% /sys/fs/cgroup
/dev/sdb15      105M  3.6M  101M   4% /boot/efi
/dev/sdc1       3.9G   16M  3.7G   1% /mnt
tmpfs           190M     0  180M   0% /run/user/1000
$ free -m
              total        used        free      shared  buff/cache   available
Mem:           1896         221        1214           0         460        1458
Swap:             0           0           0
$ nproc 
1
$ uname -i 
x86_64

This VM provides:

However, this may not be available in Norway. The Dv2 series (from USD 87/month) may be required.

The disk is known as an “OS disk” and is of the type “Premium SSD”. The field “LUN” holds the Logical Unit Number of the disk and must be unique for each VM. The OS disk by default has a LUN of “0”. You may store data on an OS disk, but you can set up one or more data disks in a separte step. You obviously need to find what size is best for your intended use. The great thing about Azure is that it is so simple to scale.

The canonical name is set up for you.

Creating a Microsoft Azure VM

In this section I'm going to show how to create a VM on the Microsoft Azure cloud service.

If you already have a Microsoft account pr GitHub account, you don't need to create an account. Use of one of these instead.

Visit this link to login or create an account (warning: browser back don't work).

tipYou currently get US$ 200 (to be used within the first 30 days of sign up) and 12 months of select free services (subject to change).

  1. Register an account with Microsoft (if you don't already have one).
  2. Log in to the portal with the browser.
  3. Create a new VM in the portal and log in to it using ssh.

When logged in on te portal, from the home page “subscriptions” let you see your subscription ID. Microsoft support personell will request it.

Register an account

It is simple to get started with Microsoft Azure. Just go to their website favourite web browser and sign up for their “Azure free account“”.

After creating the account log on and select the Potal in the top menu. This is a page that shows all Azure services on top and also provide navigation and tools.

You're now ready to create a VM.

Create a new VM

Go through the following ten steps to create and start a new server instance at the “(Europe) North Europe” data centre. It is physically located in Ireland.

  1. Click the Create a resource button.
  2. Click on Ubuntu 18.04 LTS.
  3. Fill in the form:
    • For “Region” select “(Europe) Norway East”.
    • For “Size”, select “Standard_B1ms” unless you have special requitements.
    • For “Authentication type” select “SSH Public key”.
    • For “Username” select your the username that match the computer you will use ssh from (not “root”).
    • Paste your SSH public into the textfield. This is necssary to be able to authenticate.
    • Select SSH, HTTP and HTTPS and as inbound ports. Make sure “Allow selected ports” is selected.
    • Click Review + create.
  4. The form will be validated. If it is OK, you will shown product details and terms. Click Create at the bottom of the screen.
  5. This will deploy the VM. Deployment will create four rresources and takes about one minute.
  6. After deployment, three “Next steps” are recommended. These are described below.
  7. Click Go to resource.

Expect it to take some minutes before the new server instance is fully set up and ready for use.

When the instance is ready for use, you will be able to log in without a password on the VM with ssh. Use the IP-address as hostname until you've configured DNS.

Navigate to Home » VM Name » Connect to learn the IP-address.

To inspect insight logs, navigate to Home » VM Name » Monitoring Insights » Go to Insights (if you subscribe to this resource).

Operations and monitoring

  • After deployment of the new VM, three “Next steps” are recommended. These are:

    The auto-shutdown operation perform an automatic shutdown at a specific time. To toggle, navigate toHome » VM Name » Operations » Auto-shutdown (in left sidebar)

    To monitor the VM, etc. you need to deploy a billed service called “Insight”. It takes about 5-10 minutes to set up. Do not close window while this goes on. To enable or inspect navigate to Home » VM Name » Monitoring » Insights (in left sidebar).

    You may run a script on virtual machine directly from the browser. This operation creates a file named “script.sh” from the commands you type and uploads it to /var/lib/waagent/run-command/download/2 and runs it as “root”. It shows the output of stdout and stderr. To do this, navigate to Home » VM Name » Operations » Run command (in left sidebar).

    Troubleshooting

    The free (basic) support only provides access to search and troubleshooting wizards. Azure charges $ 29 per month for “developer” support (this gives access to a ticket system that is responded to by humans on weekdays). GIYF.

    noteOne cannot use ping (ICMP) for troubleshooting connectivity on Azure VMs. To defend against ICMP flood attacks, ping is blocked by Azure.

    You may experience that SSH suddenly stops working (after working fine for some time). You can reset the SSH configuration in the Azure portal by going through th following steps:

    1. Select VM in question
    2. Select “Reset Password” (in left sidebar).
    3. Click radio button “Reset Configuration Only”.
    4. Click “Update”.

    Source SO: Cannot SSH to Azure VM.

    Final word

    [TBA]


    Last update: 2020-06-02 [gh].