ARM Templates and Baselining

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with

Already have an account? Sign In »

7 hours 46 minutes
Video Transcription
Hello and welcome back to Cyber Aires. Microsoft Azure Administrator A Z one of three course. I'm the instructor, Will Carlson. And this is Episode seven Armed templates and baseline.
In today's episode, we're gonna talk about some of the many benefits of armed templates were gonna look a quick way to get started using them without having to create them from scratch with quick start templates.
We're also gonna talk about the syntax of the armed template so we can understand what's really going on in a template when we look at it and we're gonna talk about a really powerful feature of armed templates when we use them to baseline our current environment.
So to get started, what are some of the benefits of armed templates? And
I guess the best place to start is to explain that an armed template is what's being created by and for the arm, a p I. Every time we do anything in portal
and the azure portal we're clicking on buttons were filling in fields, and it's generating an arm template.
This arm template is a Jason document or Java script object notation. Ultimately, it's just a text file telling the arm a p I what it is that we want built.
So in Azure, we're deploying infrastructure as code, and doing that alone increases consistency of our deployments because we can deploy that code ah, 100 times, and it's gonna look the same every single time. That consistency leads to fewer errors in our deployments, and
being able to click a button and deploy resource is makes us much more efficient as administrators.
Using infrastructure is code also gives us the ability to do code reuse. And why this is important is for reasons a lot surrounding a version ing or think get hub. Since we're deploying code
as a simple text file, we can manage those text files and all the version control's role forwards rollbacks across the globe. That version control gives us
another benefit here of using infrastructure is code via the armed templates is much more simplified orchestration.
I'll talk quite a bit in the course about a development team example, but let's assume we have a development team that when they do testing need 30. Resource is spun up an I t. And the I t environment. They don't need them all the time. They only need them when they're doing testing. But there's enough resource is there that it's relatively complicated to spend them up manually every single time
through the use of an arm template. I can click a button, and it's gonna deploy that 30 resource environment for development every single time. I literally click a button and walk away. Hopefully, you can see
there are a lot of benefits to arm templates, and it's worth our time. Is administrators, even if we're not doing the easy one of three exam toe, understand what they are and what they do. And to get started, we're gonna go ahead and dive into the azure quick start templates Web page, and
this is gonna be a host of templates that are already created to do so many different things.
You can search through here 789 templates as of today, but since this is community driven, it is constantly growing. If there's something you want to do, an azure, check the quick start templates first and see if it's already being done.
If it's not being done exactly. If you know how to manage and edit the armed templates, you're likely can tweak the template to do exactly what you wanted to do.
We're gonna go ahead and click on one of these. We're gonna deploy and even to be m with the docker engine.
This tells me a little bit about it. We'll explain some of this and what this means here on this page. But to get started, we're gonna go ahead and just deployed to Azure.
Go ahead and sign into my azure account,
and that brings me into the template deployment window. Now, we're gonna look at the template here real quick and talk about what makes up this template. And we're looking at the Jason of the deployment template right now. And
at the top here is gonna be schema. You'll see this in every template. This is just their reference for the syntax of the template itself. In what version of choosing
his content version here is going to be for the template designer or for yourself just for reference so you can keep up what version of the template you're using.
And we're really gonna get into the interesting part of templates here, starting with parameters and parameters are going to be things that are set at runtime. So when we deploy this template, these parameters were going to have to fill it.
And to show you those real quickly make note here of
D. N s name for public i P.
So when I come back out here to the deployment screen well, see, here's the parameter and it's asking me to set it.
Ram eaters can specify drop down lists and the values and them Ramblers can specify a whole host of metadata, including tool tips and other things. But if we come back here,
we can talk through a little bit about what a parameter looks like. So this D. N s name for public I p is a string, and the metadata here is just the description that was pretty straightforward. But when we jumped down to the U Bahn to OS version,
you can see it's a string with a default value. The matter data includes the description, which is just the tool tip.
And then there are also some allowed values. So although the parameters allow me to configure the template of deployment time, they still box me into a series of approved options here as well and
what parameters really do is they allow me to use this template for more use cases than just one. Now, I could hard code these parameters as variables and not give the end user any input, which may be what you do for your own environment. But
for a public template, clearly they're gonna want me to be able to set some things unique for my environment and
parameters of the way that you do that
mentioned variables and variables in a template are going to be just like variables and many other programming languages. They're gonna be things that are used throughout the template, multiple times in multiple places.
Knowing about variables here in armed templates is important because you may not want to follow this naming scheme that the template designer put in place so I can come in here and change the name of the Nick. I can come in here and exchange and change
the name of the VM itself all by changing variables.
Something else will see here in this arm template are gonna be resource is, and these are the actual resource is that are ultimately being deployed here in Azure.
Now the Jason for these may not make sense, but as we go throughout the course, you can come back to these armed templates and what's here. We'll make a whole lot more sense, but
very simply, we can see that this is a Microsoft dot network. Is the service provider which will talk more about this Is assigning a public I. P. Address. The name for this is pulling from a variable. Its location is also pulling from a parameter set. It run time. And here's some properties of that public I p address.
There are some other things that we don't see in this particular template that can be included. And those were going to be
functions and outputs and functions in a resource and armed template are gonna be functions just like in any other scripting language, little tidbits of code that you can reuse over and over. And outputs are gonna be things useful. For example, if we make this deployment and I wanted to call a Web hook
to make a documentation in my I t sm system that this deployment was done and we have new resource is too man.
So again, schema, content version parameters and variables. Resource is what we see here. Functions and outputs are gonna be things that you may also see as well.
And when I come back out to deploy this solution, all I have to do is click purchase.
Now it's good to know and be able to read through an arm template, because some of these templates include other things that are going to be paid. Service is in some third party solutions as well. So before you deploy quick start template, it's always a good idea to familiarize yourself with what's actually going to be deployed.
Fill the form out, filling all the parameters that are required. Click purchase, and it's going to make this deployment and my azure ecosystem. Now
there's another way to do this as well. We can come up here to create a resource and search for templates.
It's like template, deployment and hit create.
Now you can build your own template. You can start with a common template, or you can load templates from the get up. Quick start templates here is well,
so using templates to manage deployments is really powerful, but an equally powerful solution is going to be based lining using these arm templates. And to show you that we're gonna go ahead and click down here into a resource group.
We're gonna go to this site resource group. And if I click on deployments here within this resource group, I can see all the deployments that remain within his resource group.
I click on this very 1st 1 That was when this resource group was created and I launched this woman to be M
and I go to Template. I can see the template that was used to deploy this resource group initially so I could basically roll back the deployment to the initial deployment. So great if I messed something up, but
not so great. If I want to redeploy all of these deployments again, I'd have to do them all individually. Which is not the most powerful way to do this.
There may have been hundreds of deployments in some of your resource groups as they age in production. So then what if I want a baseline, this entire resource group and all the deployments in it? I can click on export template
and the army p I is going to create for me on armed template for this current resource group. Now know there are some types. It can't be exported, but they weren't included. You can see more about those specific area details. Nonetheless, fixing three resource types that weren't included in this export is a lot better than rebuilding this environment from scratch
every single time.
Included here are gonna be the parameters. Are is a separate file and also how I could use this deployment or this arm template via any of these four methods ruby dot in that power shell or via the CLI. An alternative option would be just to deploy it here from the portal.
This would deploy another copy of this environment right here in port.
They could even more powerful feature, however, would be to add this arm template to library and all they have to do here is given a name and a description and save it
to see where that was created. I can come here to all service's and search for templates,
go into templates, and we can see that template that I created is right here ready to be deployed again. So
literally, guys, in about 15 seconds, I just took a snapshot of the entire resource group in all the resource is in it and created a way to deploy that all over again. So put that back in the reference of our 30 resource development team.
Example. So you get a series of specks in front of you of what they're going to need. You build that environment and is that ever perfect the first time? Not in my experience, at least. So you'll build the initial deployment, and then they're gonna be changes in tweaks and need to be made until things are exactly like the development team might want.
So you're an azure once that's all done. I can take a snapshot of that and baseline that environment, save it here for a deployment, and that allows me to spin this up in a moment's notice with a couple clicks of a button and I can walk away.
Better yet, still, when the development team are done with these resource is, I can completely delete them for my azure ecosystem altogether, and I don't have to pay for them until I need them again.
Surely you can see at this point how powerful arm templates are, and I hope you're encouraged to learn about them so you can leverage some in your admin life and to help you better understand
content for the easy one of three exam.
So today we talked about how armed templates are put together and what the schema is, all the important parts and pieces of an armed template, how it does its work.
We talked about why you should bother with armed templates at all, because it's something else new to learn and maybe a new way of thinking about deploying infrastructure for you. But it's very much worth it.
Talked about some easy ways to get started with the template, so you don't have to create templates from scratch. There are pushing 1000 templates already available for you to use and learn about. And we also talk about the powerful ability to use arm templates to take a snapshot of your current environment so you could deploy it at a future date.
Coming up next, we're gonna talk about some potential gotchas around quotas on resource quotas here in the azure ecosystem, and we're also gonna talk about a powerful way to help you organize. Your resource is in Azure called tagging.
Thanks for joining me today. I'm really looking forward to the next episode
Up Next
AZ-103 Microsoft Azure Administrator

This is a training course for the Microsoft Azure AZ-103 Certification. The Microsoft Azure Administrator training course teaches students to perform tasks like managing Azure subscriptions and resources, implementing and managing storage, deploying and managing virtual machines (VM) and networks, and managing identities!

Instructed By