Azure ARM

Course
Time
1 hour 19 minutes
Difficulty
Beginner
CEU/CPE
2

Video Transcription

00:02
in the previous video, we learned what arm templates are and what are they used for.
00:07
Now let's see how you can write your own template.
00:13
We will start with the structure of the arm template.
00:16
Each arm template contains the following top level properties
00:21
schema content version A P I Profile parameters, variables functions. Resource is in outputs.
00:31
Schema and content version are only required properties for the template.
00:36
All others are optional.
00:38
This means that you can create an arm template, that there's absolutely nothing, but it is valid, and you can create the arm deployment with it.
00:48
Let's talk through each one of those and see what they mean.
00:53
Scheme appoints tow the schema of the language that describes the template and defines what you can put in each one of those properties.
01:02
Content version is a version of the template.
01:04
It is up to you what version you gonna use, but it is recommended that you keep track of the versions of your templates.
01:12
AP I profile is a collection off a P I versions for resource types. You can use the AP I profiles to avoid specifying a P I versions for each resource in the template.
01:26
You can get the FBI profiles from Asher's Get Cup account. Just goto. Give up dot com azure
01:34
as you arrest a P I specs and look for the profiles.
01:40
Each atom template can have inputs and outputs. The inputs are the parameters that you passed. Oh, the template.
01:49
You can use those to Parliament, rise your template and make it more flexible. When reusable,
01:55
you can use the outputs to either lock information or pass. A sim puts toe another template that you have linked. We will see how to use those in the next video.
02:06
You can define your own valuables in the template.
02:09
One example can be broken. Coordinate some inputs with static text to build a dynamic name, for example, instant doing the concatenation Every time you need this name, you can create a variable and use the variable in the template.
02:25
Also, using valuables will help you standardize the way that you build different things in your template like names. We'll see how to do that in our next video.
02:37
You can also create your own functions.
02:40
Those functions are limited in functionality and have certain restrictions, but allow you to build some simple logic In your template.
02:49
There are building functions that are available and are used extensively when developing templates.
02:53
You can define multiple functions in your template. We'll look at those shortly.
03:00
The resource is is the most important part of the template, and it describes. The actual resource is
03:07
because thesis on our A property, you can describe us many resources as you want in the template,
03:13
depending on the resource type and the resource provider used, you will need to write different information for each resource is
03:21
now. Let that we know what the structure of the template is. Let's start implementing a simple template for deployment of factual resource is
03:30
we'll create a simple template that deploys a single storage account in single virtual networking. Nasher.
03:37
We'll start with an empty template,
03:39
and we'll feeling only the required information toe. Deport those two. Resource is
03:45
it is the template. So we have the schema populated will write the content version as 1000 which will be the first version of our template. We can leave the FBI profile out, or we can just select one of the valuable profiles.
04:02
Let's say 2018 0601 profile.
04:08
The next thing we need to think about is the inputs for the template
04:13
in general. When you design azure resource manager templates, you need toe. Try to obstruct us much as possible from the information in order to make the template reusable for our purposes will be very simple, and we'll just
04:30
use powder matters, which are required by each one of those three sources.
04:35
For sure, both resource is will require a location, so let's put the location a support. A matter
04:49
next. The storage account will require name storage account type, storage kind, storage, access dear.
04:59
Whether it supports only http traffic. Those will be the inputs for the storage account. Let's put them in
05:09
for each one of the inputs. Of course, you can specify the type. Most of those so far are string types. However, the last one is of type bullion, so it will work step except on Lee. True or false value for the storage supports. Http Traffic only part mentor.
05:30
Next, we need a couple off bottom enters for the virtual network. Those will be the virtual network. Name the others prefixes in the sub nets.
05:40
Let's have them in
05:43
here. You can see that. Actually, they're different types for the prefixes in the seven. It's so we can specify are a a simple type
05:51
for certain parameters.
05:55
We'll skip the variables and the functions for now, and we'll talk about those more in our design.
06:01
Let's move to the resource is the first resource will create is the storage account resource.
06:10
I will get the information for that, and let's talk a little bit about it.
06:15
So resource is the first resource is a storage account,
06:20
so the first thing you need to specify is the type of the resource. This is the resource provider. As we learn a couple of lectures about
06:30
the next thing is the name. So when you abstract the name you can use the parameters storage account name, as there is in port for the resource
06:41
location is also required. We use the powder matter for location.
06:46
They're no dependencies for these resource.
06:48
We can specify the docks so we can have application tenant engineering on our end zone.
06:56
Next is this Q.
06:58
And the skewer is object that needs to have a name.
07:01
Then we have the kind and the properties for the storage account and their values are feeling from the parameters.
07:10
Next, let's at the information for the virtual network.
07:15
I'm just copy and paste it from my prepared values.
07:23
So, as you can see
07:25
this time, the die, please
07:27
another resource provider, which is the Microsoft Network Slash Virtual Networks research provider. Again, you have a P I version. You have a name invocation and tax. However, the properties for the network are different than for the storage account.
07:44
So we typed the properties for the network, which are the other space in the sub nets.
07:50
Now let's take a look how we can clear the parameters file to use with these template.
08:00
The Perimeter's foul has a similar structure, like the template itself. And here's the schema in the content version,
08:07
and it has a big object called Parliamentary Is that contains all the parameters for the template?
08:13
No,
08:16
let's feeling some of the parameters.
08:18
He'll have the location, storage account, name storage account type, storage kind in storage access steer, which are all string tie parameters
08:31
before Marty's, probably
08:33
then the next one is, ah, storage value,
08:39
which is
08:41
bullion type of para matter. So you see that we're specifying the parameters us
08:48
just Jason values, whether their stink or bullion or some other types, as we'll see just shortly. Next, let's at the
08:58
virtual network name.
09:01
It is also a string type
09:03
Parliament did.
09:05
And then we have the IRA types, which are the which virtual network. Others prefixes In the sub nets,
09:11
he discovered. You specify dolls
09:15
again. Simple Jason values.
09:18
So you, uh, the virtual network, others prefixes with the value array of prefixes
09:24
and the surgeon. It's with a value array of the seven. It's so each sub nets has a name and address prefix as properties.
09:37
Now we have our template, Jason in our parameters, Jason, that we can use for our deployment.
09:45
As you can see, creating Adam templates is quite simple. The only knowledge you need to have his toe know howto four month Jason. In the different types of data inside the Jason, you create a template. Jason and Parametric Jason, and you're ready to go
10:01
in the next lecture. We'll see how we can actually make these templates more flexible

Up Next

Azure ARM

This series to Azure Resource Manager cover the main topics you will need to understand how Azure Resource Manager works and how to develop flexible automation for Azure resource deployments.

Instructed By

Instructor Profile Image
Toddy Mladenov
Instructor