Virtual Machines in Azure have been around for a while, but never before with such a multitude of options, both for the VMs themselves and for the techniques and tools used to create them. Azure Resource Manager, or ARM, is the latest feature provided by Azure that makes creating VMs easier. In simple terms, Azure Resource Manager allows management and creation of Azure resources, such as VMs, Databases, Storage, etc. together as part of a Resource Group, all as part of IaaS, or Infrastructure as a Service, from Azure. Creating Azure resources using ARM is what is known as IaaS v2, and is different in both the creation process and how the resources actually reside and operate in Azure.

Before you decide to create your VMs or other resources using ARM, you’ll want to make sure this process is right for you. For example, if you plan to use Azure Backup services, be aware that the newest types of Azure Backup is not yet compatible with IaaS v2 VMs (although hopefully that will change in the near future). We’ll cover more about the differences between IaaS v1 and v2 in later posts, or you can take a deeper dive into the distinctions here.

In this post, we are going to look at one feature of ARM – VM creation through templates. First, let’s see what it looks like to create a VM using a pre-existing ARM template from the Azure portal.

Creating VMs using Azure Portal

The steps here are so straightforward. Choose Virtual Machines (not the classic one) from the Portal, then Add.

2016-01-23 14_35_17-Virtual machines - Microsoft Azure

This will take you to the Azure Compute Marketplace, where you can choose one of hundreds of VM templates to use. I’ll choose SQL Server, and then choose a specific version within that template category.

After choosing the template, you will be asked to provide values for the parameters of the template. Take note of this, as we will later learn how to create these parameters ourselves. Also note your user name and password, since you will need them to log onto the machine once it is created.

2016-01-23 14_40_24-Basics - Microsoft Azure

When setting up the VM size, it’s nice that you are provided with suggested configurations for the template you are using. I use this when I’m not sure what options are recommended.  You can choose ‘View all’ to see the rest of the sizes. I also like the estimated monthly prices that are shown for each size and options. It’s easy to see if I am configuring a VM that will cost $1300 per month to run, or one that will cost $13! Note here also that the configurations have names and numbers that correspond to the VM series and family. D series, in this example, are higher performance machines intended for more intensive operations, which is why these are recommended for my SQL Server VM.

2016-01-23 14_43_32-Choose a size - Microsoft Azure

Once we click create, the deployment of the VM will complete in a few minutes. That’s it for a simple creation using the portal. From this point the VM will be running and viewable in your Azure dashboard, and you can connect to the machine as usual.

Creating VMs using Visual Studio

Alternatively, you can create Azure Resource Manager VMs using templates in Visual Studio. In my next post in this series, we will delve further into the rest of the template creation as we set up our own VM network. For now, to create a very simple VM template for a Windows machine using Visual Studio 2015, start by creating a new Azure Resource Group project. If you don’t see this project type, make sure you have installed the Azure SDK.
2016-01-24 23_30_00-New Project2016-01-24 23_30_25-Microsoft Visual Studio (Administrator)
Let’s look at the simplest VM, a Windows machine. The templates provided in this dialog may not cover your exact situation, but once the project is created you can customize what’s there, start over from scratch, or replace with a template that meets your needs. An excellent place to start for templates for Azure Resource Manager is the VM quickstart git repository.
In the resulting project, the files needed for a VM template are added for you. A deployment script, the main VM template JSON file, and the parameters.json file. This is really all you need to create a VM using ARM, and from this point, you can check these files or project into source control, and share with an entire team to ensure everyone who needs to create VMs can do so in a reliable and repeatable way.
2016-01-25 15_38_01-AzureResourceGroup1 - Microsoft Visual Studio (Administrator)
Using the JSON Outline, you can see the parts of the template that make up the configuration options of the VM. Here, if you want to change the name of the machine to something other than MyWindowsVM, you can do so. We’ll take a closer look at the rest of the template structure in the next post. But for now, let’s just try a test deployment with the default settings. Right click the project and choose Deploy to start the deployment process. You’ll be required to sign into your Azure account if you haven’t already.
   2016-01-24 23_26_42-AzureResourceGroup1 - Microsoft Visual Studio (Administrator)
Here you can choose to edit the parameters of the template by choosing Edit Parameters from the dialog. You can also save these values to the physical file in your project, ensuring that each deployment will use the same parameters. And finally, once you select Deploy, the PowerShell script will execute for you and initiate the deploy. And, if you are more PowerShell-savvy than I am, yes of course you can execute the PowerShell commands yourself.
2016-01-25 15_53_03-2016-01-24 23_19_50-AzureResourceGroup1 - Microsoft Visual Studio (Administrator
I really like the simplicity of the Visual Studio method the best, plus I get to work in an environment I am familiar with and let the template and ARM handle the rest for me. Come back tomorrow for Day 2 of this series, where we will look further at how these templates can make VM creation easier.
The following two tabs change content below.