Skip main navigation

New offer! Get 30% off one whole year of Unlimited learning. Subscribe for just £249.99 £174.99. New subscribers only T&Cs apply

Find out more

Demo: Azure Resource Manager Templates

OK, let’s take a look at a quick example of using an ARM template to actually deploy some objects in one of my Azure subscriptions. And to get started, I’m going to use the Quickstart templates that we talked about. And so to find this, you can just pick a search engine, type Azure Quickstart Templates. And one of the search results will take you to this site right here. And you can browse through all the available templates. There’s a lot in here that are basically community-driven. We’re just going to pick the first one on the list, which is Visual Studio Development VM. So that’s a new virtual machine that has Visual Studio installed so that I can start writing code.
So we’ll click on it. It’s going to take us out to some information on the template. We can see that it needs a username and password, a version of Visual Studio, and then the DNS name that you want to use to access the virtual machine. It also gives you some PowerShell and some command line commands if that’s the way that you want to do it. So it really makes it real simple and real easy. We’re simply going to click the Deploy to Azure button. That’s going to take us to our Azure portal. I’ve already logged on to the portal, so it’s going to go right there. Prompt me for the parameters, and that’s basically it. So here’s the template.
Here’s the parameters. We’re going to go ahead and fill these in. So I’m going to call this one sysadmin, my password, a version of Visual Studio– and I’m going to pick the Visual Studio Professional 2015– and a public DNS name, so chdevwork01. Click OK and that. Choose my subscription. Create a new resource group.
Let’s call this one DEVTools. A region, and then we accept the legal term saying that, hey, by doing this, you may wind up spending money.
And we’re now ready to launch the deployment.
And so that’s going to submit the deployment to Azure. And depending on the load in four or five minutes, I’ll have a brand new virtual machine with developer tools installed. Now, the thing to realise is that it’s going to create a number of objects up in Azure that you’ll see when this deployment completes. But because I’m using the template, I don’t have to worry about all the definitions of those objects. The template brings all the different settings, all the dependencies, all the configurations together. So you’re simply supplying those couple of simple inputs. There’s a link which says– learn more on GitHub. We’ll click on that. It’s going to take us to the actual storage location for that template.
And so we can see here’s the files that make up the template. We’ve got a Read Me with some notes and documentation. We have an azuredeploy.json file. This is the actual template itself. If we click on it, we can see here it here in json notation, which is just a file structure, all the different settings that are used to build the objects in Azure. Now, this is a particularly simple one. It simply is a virtual machine with some networking on it and a copy of Visual Studio installed. But if we start at the top and scroll down through, we can see where it prompts us for a password.
It gives us a list of available versions of Visual Studio, asks us the question to pick the version, and then creates all the different settings that Azure needs to deploy these different objects. Let’s go back and take a look and see if our deployment is completed yet. Click on Resource Groups. And here’s our DEVTools resource group.
And inside this resource group, I now have a running virtual machine.
So it’s still loading the status information here, but there we go. So it’s still in the process of being created. So the virtual machine is not finished with its initial setup yet. But that’s how you leverage a template from the Azure Quickstart templates to deploy new objects in Azure.
Now, the next logical question that people who look at this for the first time ask is, well, that’s using a template that’s stored in GitHub. What if I I’m a company and I want to have all my own templates? I don’t want to store them in a public repository like GitHub. I want to build my own templates and keep them for just my staff and my administrators to use. Well, that’s also pretty simple to do. Within Azure, there’s a Templates area. And if you click on it, it’ll show you templates that you have for your organisation. Now, I’ve already created a couple of templates in here. But it’s a real simple thing to do. We click Add.
We give it a name.
The name can’t have any spaces in it.
And then we write the definition of the template. Now, writing an ARM template from scratch is a little bit of a more advanced topic. And there are tools available, such as Visual Studio, the Community Edition, the free version, that have wizards and editing tools that let someone who knows a little more about Azure and wants to build their own templates, it simplifies the process of going in and building these ARM templates. But assuming that you know how to do it, you could write it in a place like Visual Studio then just copy/paste it in here. I could take, for example, code from GitHub, just copy/paste all this template material, modify it, and use it to create my own templates.
I’m going to cancel this one and go back and look at one I created earlier. So I’ve got one here for a simple VM deployment. If I click on it, we can actually see the template that’s used.
And so this is all the JSON notation that describes how to deploy just a simple VM in Azure and all the associated properties and parameters that we’re going to use with it. Deploying this template, in other words, creating a VM base on this template, is simply a matter of clicking the Deploy button for the template. And close a couple of these open blades just to clean up the screen. And we’ll click Deploy.
Now we’re on a very similar experience to what we had a few minutes ago with our Dev Template. It’s going to ask us for our parameters, an admin username, and password, and then the version of the operating system that we want to deploy. Use an existing resource group. We’ll just put this one in the DEVTools group that we created before.
Accept the legal terms.
And we’re now set to go. Click Create. And it will submit a deployment for another virtual machine that’s going to go in that exact same resource group. So again, two ways that you can do this. You can use templates that are stored in public or external repositories, like GitHub, like within Visual Studio. Or for your Corporate or your Enterprise Azure subscription, there’s an area within the subscription where you can store your own templates and conduct your own deployments from there to keep them in a central managed location.

In the previous step, we learned how we can use GitHub to build and deploy solutions on Azure. This video is a quick demonstration of the benefits of the Azure Resource community templates. Here we will take an in-depth look at two different deployment models available in Azure.

You have already discovered that Azure Resource Manager is a deployment methodology that allows you to define what you want for infrastructure. It allows you to define your entire deployment in a file, called an Azure Resource Manager (ARM) Template.

Benefits of using ARM Templates

  • Simple redeployment for test, dev and production
  • Use templates to create Resource Groups
  • Apply templates and automate with PowerShell

We will now move on to the next step which is Automation DSC.

Join the discussion

What environments does your team currently develop in and for? Could you find any potentially useful templates on the Git Quickstart list that may serve you?
Use the discussion section below and let us know your thoughts. Try to respond to at least one other post and once you’re happy with your contribution, click the Mark as complete button to check the step off, then you can move to the next step.
This article is from the free online

Microsoft Future Ready: Fundamentals of DevOps and Azure Pipeline

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now