Friday, February 26, 2016

Azure Resource Manager basics

One of the challenges of working in a virtual infrastructure envionment is that you need to keep track of all the different resources. Things like virtual machine images, storage, network cards, etc all need to be assembled into a completed virtual machine.

Typically, all of this has been done piecemeal and by hand. Microsoft’s best practice is to move away from this IaaS version 1 to IaaS version 2 or using something it calls Azure Resource Groups.

You can basically think of Azure Resource Group as a container into which you put everything your need for your infrastructure configuration. Because everything is now in a single object it makes it easier to build and delete if necessary. That way it makes it easier to build is that you can now basically script the whole process.

The following will take you through a very basic process of creating a single Azure virtual machine using the Azure Resource Manager so you get an idea of the differences from the ‘classic’ method of building infrastructure.

The easiest way to deploy using Azure Resource Manager is to use Visual Studio. However, don’t install Visual Studio first! You’ll have problems if you do.

image

Instead, visit the following location:

https://www.visualstudio.com/en-us/features/azure-tools-vs.aspx

and select the link to Download Azure SDK and then run the download.

image

This will launch the Web Platform Installer as shown above. This will download not only the free Visual Studio Community Edition but also add the appropriate Azure components for you automatically.

image

You should now see the installer for Visual Studio Community 2015 with Microsoft Azure SDK displayed as shown above.

Select Install to continue.

image

Ensure you have enough free space on the machine to install all the components. The total size of the installation is displayed as shown above.

Select I Accept to continue.

image

The installation will then commence. This whole process of downloading and installing the appropriate components will take a fair amount of time, so generally allow 45 – 60 minutes for the process to complete.

image

You’ll see the progress displayed on the lower bar along with the total of components that have been installed so far.

image

When the process is complete, you’ll see the above screen.

Select Continue.

image

You’ll then see a summary of installation process.

Select Finish.

image

You’ll then be given the option to download additional components if desired.

Select Exit.

image

Run Visual Studio. Select File | New | Project.

image

On the left hand side of the dialog that appears, open Installed | Templates | Visual C# | Cloud. On the right, you should see Azure Resource Group at the bottom of the list, as shown above.

Select Azure Resource Group, provide a name for the project and press the OK button to proceed.

image

You’ll then be prompted to select an Azure template. In this case Windows Virtual Machine will be selected.

After selecting the template, press OK to continue.

image

This will open Visual Studio proper on your desktop like shown above.

image

In the top right you’ll see the Solution Explorer box as shown above. In here will be a Templates folder that you need to open. You should then find two .JSON files inside.

Select WindowsVirtualMachine.json to continue.

image

This should open the file in a large window in the center of the page.

Take a look through the file to see all the options. If you want to customise your virtual machine deployment you’ll need to do it in this file.

However, don’t make any changes to the file at this stage.

image

Right mouse click on the project name in the Solution Explorer box in the top right of the Visual Studio desktop.

From the menu that appears, select Deploy and then New Deployment from the submenu.

image

This will open a new window as shown above. Here select Add an account.

You’ll then need to add the login details for the Azure account in which the new Virtual Machine will be created in.

image

When you have added your Azure account most of the remaining fields will be populated has shown above.

Select the pull down option for the empty Resource group.

image

From the pull down menu that appears select <Create New…>.

image

Enter a name for the Resource Group. This will the container in which all the assets live.

Next, select a region where this Resource Group and the items it contains will reside. Here, Australia East has been selected.

Select Create to continue.

image

You’ll be returned to the previous window. Here, select the Edit Parameters button.

image

Enter the virtual machine administrator login name in the adminUsername field.

Enter the virtual machine administrator password in the adminPassword field.

Enter a name in the dnsNameForPublicIP field. This fieldmust be in lowercase and not contain special characters (i.e. !@$%- etc is not supported).

All of these values could have be entered in the configuration JSON if desired.

It is also recommended that you select the option Save passwords, otherwise you’ll be prompted top continually enter all these details during the creation process.

image

When complete, select the Save button to continue.

image

Select the Deploy button.

image

The deployment of the Resource Group will now commence. You can view the progress in the Output box at the bottom of the Visual Studio desktop.

image

The results of each step in the deployment process will be displayed. If there are any errors they will also be displayed here.

image

If you now look in the new Azure portal, as shown above, under the Resources groups area, the Resource Group just created should appear. Select this.

This will then display all the assets contained within that group. Select any whitespasce in the lower part of this blade.

Doing so will open the Resources blade where you can see each individual resource as it is created. Select the Refresh button at the top of the page to see new resources as the configuration progresses.

image

After a while the Output box on the Visual Studio desktop should show you that the deployment process is complete as shown above.

image

If you then return to the Resource Group and drill down into the virtual machine, you should see something like shown above. That is a running virtual machine.

So, that’s the way to get a single basic virtual machine up and running with Azure Resource Manager. It may seem like more work but as you begin to scale and manage large and more complex configurations it makes life much easier.

It is also interesting to note, as I have said many time here before, the future is about software. Azure Resource Manager shows how important it is to be comfortable with coding, which is not something I see with most IT Professionals. So now is the time to start getting comfortable!

You can also do all of this using PowerShell, which will be post coming in the future. For now, be fruitful and multiply using Azure Resource Manager for your IaaS environment.