2.13 Azure Resource Manager (ARM) Templates

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or

Already have an account? Sign In »

Time
18 hours 43 minutes
Difficulty
Intermediate
CEU/CPE
9
Video Transcription
00:00
>> Welcome back. In this episode,
00:00
we're going to talk about Azure
00:00
Resource Manager or ARM templates.
00:00
Our objectives include talking about
00:00
some Azure Resource Manager concepts and
00:00
then going into Azure Resource Manager templates.
00:00
Before we talk about templates,
00:00
let's discuss what the Azure Resource Manager is overall.
00:00
This is the deployment and management service for Azure.
00:00
Meaning this is a part of the Azure Service responsible
00:00
for deploying and building
00:00
the resources we've been working with,
00:00
whether you use the portal,
00:00
PowerShell, CLI or a rest API,
00:00
the Azure Resource Manager service is
00:00
responsible for receiving the requests
00:00
and handling the output.
00:00
The service will authenticate and authorize
00:00
the request before taking
00:00
action to build the virtual machine,
00:00
create a storage account,
00:00
or create a network peering.
00:00
Because each of these creation methods
00:00
always run through the API,
00:00
the resource will be consistently
00:00
deployed and the results will always be the same.
00:00
Now that we know what the Azure Resource Manager is,
00:00
let's talk about templates.
00:00
Templates are used to define
00:00
the resources being deployed inside of Azure.
00:00
These templates are written in JavaScript,
00:00
Object Notation or JSON.
00:00
These templates are written and what is
00:00
called a declarative syntax.
00:00
This means you don't have to worry about writing
00:00
out the logic to deploy the resource,
00:00
you just have to write out how you want the resource
00:00
deployed and the service takes care of the rest.
00:00
Now in the screenshot here we have an example of
00:00
what an ARM template looks like and in fact,
00:00
this is from two different files.
00:00
The screenshot on the left is from
00:00
a parameters file where
00:00
you can define properties of
00:00
the resource you are trying to deploy.
00:00
For example, here the location we have is East US,
00:00
which is one of our Azure regions.
00:00
Here you can see we're going to be
00:00
deploying a storage account,
00:00
so we have to give it a name and I have
00:00
my storage account 922838.
00:00
We're also using the standard LRS,
00:00
which is one of our replication options
00:00
using a Storage v2 account,
00:00
we're putting it in the cool access tier and we're saying
00:00
we're only supporting HTTP as traffic only.
00:00
On the right-hand side is
00:00
the actual ARM template deployment file.
00:00
Here we take those parameters and use
00:00
them to define the resource we want to deploy.
00:00
Again, it's a storage account and we're
00:00
inputting those parameters and as the name,
00:00
the location, and some
00:00
of the properties for the storage account.
00:00
You can see here, we're just defining
00:00
how we want the storage account to be made.
00:00
We don't have to worry about writing
00:00
out logic to actually deploy it.
00:00
This is the responsibility of
00:00
the Azure Resource Manager service itself.
00:00
It will take these properties and just go create it
00:00
based on what we've declared in this ARM template.
00:00
Let's jump back out to the Azure portal
00:00
and I'll show you where you
00:00
can use these ARM templates
00:00
when you're deploying a resource,
00:00
or you can download them after you
00:00
have finished creating the resource itself.
00:00
Here we are back in our Azure portal
00:00
and I've already deployed a storage account.
00:00
Let's go take a look at its properties.
00:00
With just about any resource inside of Azure,
00:00
if you look under the Settings and then Export Template,
00:00
we're going to be able to view
00:00
the ARM template for the resource that we created.
00:00
Let me collapse this blade here.
00:00
Here you can see exactly what we saw in our screenshot.
00:00
This is the ARM template
00:00
defining the resource that we already have deployed.
00:00
What's great is, you can download
00:00
this template and reuse it as many times as you want.
00:00
Here we have the ARM template downloaded and unzipped,
00:00
and you can see a couple of different files in here.
00:00
The two I'm going to focus on are
00:00
the parameters.json and template.json.
00:00
I'm going to open this up inside of
00:00
Visual Studio Code and it's
00:00
the exact same thing we see inside of the Azure portal.
00:00
Opening this up in Visual Studio Code or
00:00
any other JSON editor is going to allow
00:00
us to customize the deployment of our Azure Resources.
00:00
You can also take this same
00:00
template.json and use it to deploy another resource.
00:00
Back in the Azure portal,
00:00
let's go click on "Create A Resource."
00:00
You'll want to search for template deployment.
00:00
Next, we'll want to build around template in
00:00
the editor and we're going to click
00:00
on "Load File" and
00:00
select that template.json we
00:00
just downloaded for our other storage account.
00:00
Click on "Save." This is
00:00
going to open up and it looks very similar to when we
00:00
go and create our Azure Resources.
00:00
Instead, a lot of the options are already missing.
00:00
We do still need to select a Resource Group,
00:00
so I'm going to select my ARM demo
00:00
and we do need to give the storage account a name.
00:00
Now, since this storage account is already created,
00:00
it's not unique, so I'm just going to add
00:00
a couple of numbers to the end of it.
00:00
Since you are going to be purchasing an Azure Resource,
00:00
you do need to agree to the terms and
00:00
conditions and then click on "Purchase."
00:00
Let's go back and check out our storage accounts.
00:00
Let's click on "Refresh" and
00:00
our new storage account should be here.
00:00
What's great is this is
00:00
an exact copy of the storage account right above it,
00:00
except it has a different name,
00:00
it's going to have the same type of storage,
00:00
the same access tier and the same location.
00:00
You can see where this becomes really powerful.
00:00
If you have a resource created that
00:00
you want to duplicate multiple times,
00:00
you don't need to sit there and click through
00:00
the portal and do it over and over and over.
00:00
You can just export the ARM template,
00:00
create a resource, and import
00:00
that template again to create the resource again.
00:00
Well, not necessarily important for the AZ-300 exam,
00:00
I do want to point out that Microsoft makes
00:00
available several Azure QuickStart templates.
00:00
These are templates created from
00:00
the community that deploy
00:00
different resources inside of Azure.
00:00
For example, joining existing
00:00
Windows VM to Azure AD domain,
00:00
or just deploying a simple Windows VM.
00:00
Let's go check this one out.
00:00
This page display some of
00:00
the information about how the template works.
00:00
Let's go check it out on GitHub.
00:00
Here you can see this has the same files
00:00
that we just saw when we
00:00
downloaded for our storage account.
00:00
There's an Azure deploy.json file and
00:00
a parameters file.. You can very
00:00
easily just click on Deploy to Azure to
00:00
deploy this ARM template inside of your environment.
00:00
You can use these QuickStart templates as a good way to
00:00
learn about ARM templates yourself
00:00
and see how other people have built them,
00:00
as well as take other people's work and be able to use
00:00
it to deploy resources inside of your Azure tenant,
00:00
if you're learning more or just
00:00
deploying them in your production environment.
00:00
That does it for our demo.
00:00
Let's jump back to the slides and wrap this up.
00:00
That does it for this episode.
00:00
But before we move on,
00:00
I do have a post assessment question for you.
00:00
I wanted to ask what format are ARM templates written in?
00:00
If you said JavaScript,
00:00
Object Notation or JSON, you are correct.
00:00
This is the language used to write out our ARM templates.
00:00
Coming up in the next episode,
00:00
we're going to start talking a little bit
00:00
more about identity in
00:00
Azure Active Directory with
00:00
our introduction to Azure Active Directory.
00:00
See you in the next episode.
Up Next