Azure VM
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
- Introducton
- Requirements
- Creating a Microsoft Azure VM
- Operations and monitoring
- Troubleshooting
- Final word
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.
At 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:.
- Microsoft Azure Norge (warning: browser back doesn't work)
- Hvor befinner dataene dine seg?
- Pricing calculator (cumulative, delete VMs if sum is too high).
- VM product series (select virutal machines, limit region to 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:
- Cost: USD 21/month + VAT
- Ubuntu 18.04 LTS
- 2 GiB RAM
- 0 GiB Swap (TODO)
- 1 vCPU (kernel)
- 30 GiB disk
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).
You 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).
- Register an account with Microsoft (if you don't already have one).
- Log in to the portal with the browser.
- 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
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.
- Click the button.
- Click on
- 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 .
- The form will be validated. If it is OK, you will shown product details and terms. Click at the bottom of the screen.
- This will deploy the VM. Deployment will create four rresources and takes about one minute.
- After deployment, three “Next steps” are recommended. These are described below.
- Click .
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
to learn the IP-address.To inspect insight logs, navigate to
(if you subscribe to this resource).Operations and monitoring
- Setup auto-shutdown.
- Monitor VM health, performance and network dependencies.
- Run a script inside the virtual machine.
The auto-shutdown operation perform an automatic shutdown at a specific time. To toggle, navigate to
(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
(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 (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.
One 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:
- Select VM in question
- Select “Reset Password” (in left sidebar).
- Click radio button “Reset Configuration Only”.
- Click “Update”.
Source SO: Cannot SSH to Azure VM.
Final word
[TBA]
Last update: 2020-06-02 [gh].