Azure Resource Manager
The course is part of these learning pathsSee 3 more
The Azure cloud is a collection of resources that work in unison to deliver a product or a service. Hardware is virtual and services can be created and destroyed at the stroke of a key. In the context of DevOps, resources can be "spun up" as part of a pipeline. It is crucial that when resources are deployed multiple times, those deployments are consistent, repeatable, and can be automated. Doing it manually through the Azure portal isn’t practical. Azure Resource Manager (ARM) has an interface for processing resource templates that specify resource deployments.
In this course, we look at how those templates can be built and deployed. We start with a simple template and move on to more complex examples to illustrate many of the useful features available when deploying resources with templates. This course contains plenty of demonstrations from the Azure platform so you can see exactly how to use Azure Resource Manager in practice.
If you have any feedback on this course, please reach out to us at email@example.com.
- Understand what Azure Resource Manager (ARM) is and its use cases
- Learn about the different ARM templates available and how they can be used
- Deploy databases using an ARM template
- Export a template and create templates using QuickStart templates
- Deploy resources using a script
This is a beginner-level course aimed at anyone who wants to learn more about managing and configuring their Azure environment, and fast-tracking their deployments.
To get the most out of this course, you should have a basic understanding of the Azure platform.
Without a doubt, the easiest way to get started with templates is to go to a current resource and download the deployment as an ARM template. This process can be likened to recording an Excel macro and then inspecting the code to see how it works.
I’ll start by creating a virtual machine resource. Let’s just fast forward through the portal process by going with most of the defaults. It’s not important what we choose here as template creation will work for any resource. I’ll go with premium SSD and the standard networking setup. I will turn on OS guest diagnostics, take the advanced defaults, and not bother with tags. We can see before we hit the create button, we have the opportunity to download the template before getting the portal to deploy the VM. I’m going to download the template now for use later on.
Having a look at the template we can see it is made up of 22 input parameters that can be changed or substituted to alter how the resources are created. The parameters have a name and a data type. There are 3 variables that are used within the template, and of course, there are the 6 resources being created in the deployment. The parameters file contains the values that are currently used for the resource deployments. These are default values, or values manually entered in the portal when creating the VM resource, like location, machine name, and resource group. Scripts just links you to Azure documentation. The same information is accessible while the deployment is happening. For an existing resource, you can download the template or deploy from the Export Template page. Some of you might be thinking, “hang on, now there are only 3 parameters and 1 resource”. That's because this template is just the virtual machine component and doesn’t include the supporting network infrastructure resources. If you need to get the templates for all resources in a deployment after the fact, you can go to the resource group and select the resources and click export template.
Back at our VM resource, Azure lets you save templates to an online library, which is what I’ll do now by giving the template a name and simple description. You can view templates saved to the library through More Services and then select Templates. With a template, you can redeploy the resource or make a similar resource with different attributes by changing some of the input parameters.
We’ve got the template what now? The usual method for deploying resources using templates is to use a command-line interface, either PowerShell or Azure CLI. We will look at both of these later, but initially let’s create the VM resource through the portal using the downloaded template.
Search for deploy on the home page of the portal and select Deploy a custom template. Under common templates, there are templates for creating common resources that you can adapt and modify. We want to build our own template in the editor. Here we have a blank boilerplate template, which I’m going to replace with the template I previously downloaded. I’ll upload the file and save it. Once that’s been loaded, we can see that there are 6 resources in our template – correct. Now we have an interface for entering the parameters for the resource creation. Typing in all those values does seem a bit painful, but if I click edit parameters, I can upload the associated parameters.json file with all the values in it and click save. Boom, and there we go, the values that are entered as part of the resource creation wizard are filled in as parameters. We can do a side by side comparison of the parameters as they relate to the manual portal process Resource Group, virtual machine name, region, VM size, user name, disk type, and networking. I’ll fill in the password and agree to the terms and conditions. The purchase button is a bit misleading, and I assume I won’t be charged for my own template. Anyway, the template validates correctly as I would expect, and the deployment successfully completes.
As with most things Azure, there is a marketplace for templates where you can browse or search for a template that meets, or closely meets your requirements at Azure quick-start templates. I’ll search for something a little bit interesting involving Cosmos, like Create an Azure Cosmos account for MongoDB API autoscale. Clicking on the link takes us to a description of the template and its parameters, along with instructions on how to deploy the template using either PowerShell or Azure command-line interface. Browse on GitHub will take you to the template’s repo where you can download the template JSON files.
Clicking Deploy to Azure takes back to the same Deploy Custom Template page where you can enter the missing parameters using the GUI interface.
Hallam is a software architect with over 20 years experience across a wide range of industries. He began his software career as a Delphi/Interbase disciple but changed his allegiance to Microsoft with its deep and broad ecosystem. While Hallam has designed and crafted custom software utilizing web, mobile and desktop technologies, good quality reliable data is the key to a successful solution. The challenge of quickly turning data into useful information for digestion by humans and machines has led Hallam to specialize in database design and process automation. Showing customers how leverage new technology to change and improve their business processes is one of the key drivers keeping Hallam coming back to the keyboard.