Skip main navigation

Demo: Azure Resource Manager Templates

.
17.2
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.
53.7
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.
95.5
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.
133.1
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.
143.7
And we’re now ready to launch the deployment.
149.9
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.
190.4
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.
229.2
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.
259.1
And inside this resource group, I now have a running virtual machine.
274.2
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.
295.7
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.
335.6
We give it a name.
347.4
The name can’t have any spaces in it.
359.2
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.
401.4
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.
418.4
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.
445.9
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.
479.2
Accept the legal terms.
486.9
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

Our purpose is to transform access to education.

We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.

We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.

Learn more about how FutureLearn is transforming access to education