Overview of Notes and Observations when Creating a Virtual Machine in Microsoft Azure

Creating a virtual machine in Microsoft Azure via the portal can be done very quickly. Do a few clicks, let Azure do the magic in the background, and a few minutes later, the VM is ready for use.

To get a better understanding about what it really means to create a virtual machine, and what probably needs to be considered in case not only one VM is required, I had a closer look at the result of my virtual machine creation.

As there were many aspects I found noticeable or good to know, too many for a single post I think, I created a series of posts describing the details, and this post as a kind of overview or entry point for these various topics, which leads to the detailed information.

These aspects are covered by the series:

I think it is worth to note that there was no need to integrate the newly created VM into any existing environment. In fact, there were no other Azure resources created before I started the virtual machine creation.

What the Series is not about

This post series is not a guideline on how to plan, install and maintain a production environment based on Azure Virtual Machines. So in case you are looking for guidance on that, please search the Internet and / or hire a consultant.

The series does not give you all details on all features required to setup a virtual machine in Microsoft Azure. To get these, please refer to Microsoft’s documentation and all the other sources in the Internet (or books if you prefer those).

It also does not claim to cover all things one should know / need to know in all details. Probably there are things you are keen for, that I did not stumbled upon or did not found noticeable. Sorry for that, but I am almost sure someone else presents her knowledge on that in the Internet.

However, I hope nothing major is missing and you will find some useful hints and / or links.

Virtual Machine Features

Even though it was a stand-alone VM, I wanted to use it for production purposes. Therefore, it was not sufficient for me to just create a virtual machine. I also needed backup to prevent data loss, replication to be prepared for Azure location outage, and antimalware protection.

None of these things come out-of-the-box when you setup a virtual machine. Please note that they increase the total cost, because backup and replication require additional storage

Resources found after Creation

After creating the Azure virtual machine having the features named above by just clicking in the portal, plus doing a site failover test and site failover, I ended up with an unexpected high number of resources.

In total, five resource groups, twenty-five resources (six of them hidden), and ten blob containers were created by me or Azure to setup the virtual machine. And this is the number before following the security recommendations given by the Azure Advisor.

Resources found after Creation of a Virtual Machine in Microsoft Azure” lists all the resources found.

Minimum required Elements for Azure VMs

Based on Microsoft’s tutorial “Compile a checklist for creating an Azure Virtual Machine“, I’ve created my own minimum list of elements that are required to setup an Azure VM without backup or replication.

Helpful Upfront Activities

Having my first learnings when setting up a single VM, I identified three things to be very helpful to be completed upfront before using Azure VMs for production purposes. These are:

  • Define Naming Conventions
  • Define how to structure resource groups
  • Plan network requirements

The post “Upfront Activities before creating Virtual Machines in Microsoft Azure” gives more details on these three topics.

Creating my next Stand-alone VM

When I create my next stand-alone virtual machine in Azure, I will regard the following points:

  • Minimize the Number of Resource Groups
  • Optimize Disk Size and Number
  • VM Size and Disk Performance

Read this post for more details.

Disk Encryption

After completing the setup of a virtual machine in Azure, it is worth to have a look at the Advisor recommendations . One of the recommendations I found was “Disk encryption should be applied on virtual machines“. Doing some research on this topic I am convinced there is no need for action. Read “Encrypting Disks of Virtual Machines in Microsoft Azure” to see why.

Stopping the VM is not sufficient to save Money

When you stop the VM, or shut it down, you will still be charged for it. To save money, a VM has to be deallocated. Have a look at Chris Pietschmann’s blog for more details on this.

In case you want to save even more money when doing some testing, plus being sure not to break production, check out the Azure Learn Sandbox, described by my post “Save Money – Use Azure Learn Sandbox“.

Site Recovery

To be prepared in case of a failure of the primary location of my Azure VM, I’ve activated the Azure Site Recovery. After completing a manual failover for testing purposes, I was surprised how much manual work was required to make the replicated setup look like the source and have all features enabled and back in place. Also the cost aspect should not be underestimated.
To see what I learned about replication, have a look at “Virtual Machine Site Recovery in Microsoft Azure“.

Copy / clone a VM

From time to time it is helpful to be able to create a copy or clone from an existing virtual machine. “Copy / clone a Virtual Machine in Microsoft Azure” presents what I learned about the options.

(Re-) Size of Azure Virtual Machine Disks

When you create a virtual machine in Azure based on an existing image, you cannot define the size of the operation system disk. Unfortunately, you even can’t see what the disk size will be when you create the VM. I also was not able to find a table giving this information. This post shows some options to change the disk size and what the disk size also implies.

Delete the VM

To delete all resources related to a single virtual machine might become a real challenge. Reason is that there is no one-click option available at the moment. It was announced by Microsoft in June 2019, but still not there one year later. “Challenge: Delete Virtual Machine in Microsoft Azure” hopefully gives some assistance when faced with this challenge.

Create a new VM based on the learnings

Of course, after having all my learnings writting down, I wanted to know how things work when I follow my own suggestions. Accordingly, I created a new virtual machine.

Useful CLI Commands to start and stop a Virtual Machine

I am using my virtual machine in Azure to do development tasks. That means, as long as I am not doing any development, I do not need the virtual machine. Accordingly, to save money, I deallocate the VM when I’m done, and start it again when there are new development tasks to be completed.

To simplify the start and stop of the VM, I have created two PowerShell scripts using Azure CLI commands.

Additional Topics

Here is a small collection of things not worth to write an additional post, but worth to be mentioned (from my point of view).

Azure Advisor

The portal asks from time to time to have a look at the free recommendations the Azure Advisor created.

Microsoft says “Advisor is a personalized cloud consultant that helps you follow best practices to optimize your Azure deployments.” The recommendations are divided into five categories: Reliability (formerly called High Availability), Security, Performance, Cost, and Operational Excellence.

Azure Advisor

Remarkable Post

I found a large post about many aspects of Azure Virtual Machines at CloudReferences.

Microsoft Learning Module

My preferred Microsoft learn module about virtual machines is “Administer infrastructure resources in Azure“.

Even more Security: Azure Bastion

Azure Bastion promises to make public IP obsolete for RDP and SSH access and so improves security. I have not tried it yet, but found it worth to add it to this list as a reminder.

Links

Attempt to create a Virtual Machine with one Resource Group only in Microsoft Azure
Azure Advisor
Azure Bastion
Azure Site Recovery
Azure Virtual Machines at CloudReferences.
Challenge: Delete Virtual Machine in Microsoft Azure
Chris Pietschmann’s blog post “Deallocate VM to save Money
Copy / clone a Virtual Machine in Microsoft Azure
Encrypting Disks of Virtual Machines in Microsoft Azure
Microsoft learn module Administer infrastructure resources in Azure
Minimum required Elements for Microsoft Azure VMs
(Re-) Size of Azure Virtual Machine Disks
Resources found after Creation of a Virtual Machine in Microsoft Azure
Save Money – Use Azure Learn Sandbox
Things I will regard when I create my next VM in Microsoft Azure
Upfront Activities before creating Virtual Machines in Microsoft Azure
Useful CLI Commands to script Start and Stop of a Virtual Machine in Microsoft Azure
Virtual Machine Site Recovery in Microsoft Azure