The Azure Guide/Virtual Machines

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Azure is most known for its ability to quickly provision, deploy and remove virtual machine of various sizes in various operating systems for different purposes.

Creating a new virtual machine[edit | edit source]

On the main Azure portal, click Create a resource. This will bring you to a menu where popular configurations can be quickly selected. For the purposes of this guide, we'll go with the Windows option.

The next stage is a short wizard where we configure the VM properties.

Basic[edit | edit source]

Firstly, choose the subscription where you have the licence (this could be Pay as you go if applicable). Then, we need to select a resource group wherein all the resources are stored. It may be the case that you have to store all the resources in one group for easy cost-management; if you don't have one, simply create a new group.

The next step is to consider the properties of your virtual machine. This is mostly up to you. Consider different factors, for example,

  • the operating system you need,
  • the hardware specifications you require,
  • the budget that you have (or if applicable, the credit remaining on your account)

Remember that if you are on an eligible subscription like Visual Studio Enterprise, you can use Azure Hybrid Benefit in many cases to save the licence cost as that would be taken care of by the subscription.

Choosing your VM type: There are many different types of VMs which you can select, and for the most part, you should be just fine with concentrating on your CPU, disk and RAM requirements. Some of the configurations will overlap; this is fine. Exceptions to this include if you require a GPU (N-series) - in that case other types will not include a graphics adaptor at all (as they are connected remotely). This might be helpful as well.

Personal note: While my subscription (Visual Studio Enterprise) covers Windows Client licences, I was unable to apply this benefit on virtual machines which were not configured with Windows Server. Instead, an error came up, saying that "License type "Windows Client" is required". The Azure Portal now simply hides this option.

The next step is to set up an administrator account, which is fairly self-explanatory. After that, you have to choose the ports your VM will communicate publicly. For Windows virtual machines, you're likely to require RDC (so that you can use remote desktop connections to communicate to your VM), and for Linux VMs, SSH is a natural choice, but your needs might vary.

The last stage allows you to configure Azure Hybrid Benefit if your operating system and subscription allows it.

Disks[edit | edit source]

In this step, you choose the disk(s) that will power your virtual machine. As for choosing the type, usually going for the Standard SSD option will do, unless you have extreme data requirements (Premium SSD) or you are sure that your task does not require much disk activity (Regular HDD).

Note that the VM also has a temporary disk which will be deleted whenever the VM is restarted.

As for Ultra Premium SSD, it should not be required for most scenarios. The Azure website mentions that:

Azure Ultra SSD (preview) disks deliver high throughput, high IOPS, and consistent low latency disk storage for Azure IaaS VMs. Ultra SSD is suited for data-intensive workloads such as SAP HANA, top tier databases, and transaction-heavy workloads. Adding this capability on results in a reservation charge that is only imposed if you enabled Ultra SSD capability on the VM without attaching an Ultra SSD disk.

portal.azure.com

Networking[edit | edit source]

Usually, there is nothing to configure in this if you're creating a virtual machine for computational purposes. Here, you can configure advanced networking settings for your VM.

Management[edit | edit source]

Unless you are debugging the VM for issues or for other such reasons, there is no need to turn on diagnostics and hence should be kept off. The same applies for the option to automatically shutdown every day.

Advanced[edit | edit source]

This section is useful if you want to pre-allocate your virtual machines with useful extensions that you're likely to install yourself, but otherwise can be skipped.

Tags[edit | edit source]

This section can be ignored in most cases.

Review + create[edit | edit source]

Here, you will be given the opportunity to review the information you've created and to make sure that it meets your needs, and will be able to preview the price for your virtual machine. If there is something incompatible with your selections, then an error message will pop up saying that "Validation failed. Required information is missing or not valid." and will point you towards the problematic section(s).

When you are done, click Create. A new VM should be deployed and ready to use in a couple of minutes.

Accessing the VM[edit | edit source]

This depends on how you've created the VM. On Windows VMs, launch Microsoft Remote Desktop Connection on your local machine (included on Windows; downloadable on Mac and mobile devices), and use the public IP address provided. The connection reliability is usually good, assuming that you have a sufficiently fast internet connection. It's the same process as accessing a remote machine.

Similar steps apply if you're accessing the VM through the SSH method.

Remember that merely closing the VM does not stop it from running; you need to stop it from the Azure portal. Additionally, even if you stop the VM, you will still incur charges for the disks (and other resources) that are still in the VM. To not incur any charges at all would potentially mean deleting the whole VM - along with all the resources attached to it.

Using a GPU[edit | edit source]

Only applicable for N-series VMs.

The N-series VMs include NVIDIA GPUs, and are mostly meant for cases where high rendering power is required [1]. There are multiple N types available, and the only one that is open to all by default are the NC-series VMs.

Once the VM is created, you must install its drivers, which can be done here on Windows. Alternatively, the NVIDIA GPU Driver Extension should be installed through Azure, which will automatically do it for you[2].

Monitoring[edit | edit source]


The Azure portal includes various monitoring tools so that you can easily track the performance of your VM without having to log in manually. This can prove very helpful for high-load computational tasks where you don't know when the task will finish (as you can use the monitoring platform to track the usage - if it drops off drastically, then the task is most likely done) or to check for unexpected load leaks. You can also configure this by duration.

You can also connect back to the VM, stop or restart, or capture snapshots (which contain all the data of the VM at that point).

The portal can also be used to configure most settings that you already did when you first set up the VM, including for features like auto-shutdown, metrics (which allows for a further level of analytics on the VM) and so on.

References[edit | edit source]

  1. https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sizes-gpu
  2. https://docs.microsoft.com/en-us/azure/virtual-machines/windows/sizes-gpu