in the previous video, we learned what arm templates are and what are they used for.
Now let's see how you can write your own template.
We will start with the structure of the arm template.
Each arm template contains the following top level properties
schema content version A P I Profile parameters, variables functions. Resource is in outputs.
Schema and content version are only required properties for the template.
All others are optional.
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.
Let's talk through each one of those and see what they mean.
Scheme appoints tow the schema of the language that describes the template and defines what you can put in each one of those properties.
Content version is a version of the template.
It is up to you what version you gonna use, but it is recommended that you keep track of the versions of your templates.
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.
You can get the FBI profiles from Asher's Get Cup account. Just goto. Give up dot com azure
as you arrest a P I specs and look for the profiles.
Each atom template can have inputs and outputs. The inputs are the parameters that you passed. Oh, the template.
You can use those to Parliament, rise your template and make it more flexible. When reusable,
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.
You can define your own valuables in the template.
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.
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.
You can also create your own functions.
Those functions are limited in functionality and have certain restrictions, but allow you to build some simple logic In your template.
There are building functions that are available and are used extensively when developing templates.
You can define multiple functions in your template. We'll look at those shortly.
The resource is is the most important part of the template, and it describes. The actual resource is
because thesis on our A property, you can describe us many resources as you want in the template,
depending on the resource type and the resource provider used, you will need to write different information for each resource is
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
we'll create a simple template that deploys a single storage account in single virtual networking. Nasher.
We'll start with an empty template,
and we'll feeling only the required information toe. Deport those two. Resource is
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.
Let's say 2018 0601 profile.
The next thing we need to think about is the inputs for the template
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
use powder matters, which are required by each one of those three sources.
For sure, both resource is will require a location, so let's put the location a support. A matter
next. The storage account will require name storage account type, storage kind, storage, access dear.
Whether it supports only http traffic. Those will be the inputs for the storage account. Let's put them in
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.
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.
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
for certain parameters.
We'll skip the variables and the functions for now, and we'll talk about those more in our design.
Let's move to the resource is the first resource will create is the storage account resource.
I will get the information for that, and let's talk a little bit about it.
So resource is the first resource is a storage account,
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
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
location is also required. We use the powder matter for location.
They're no dependencies for these resource.
We can specify the docks so we can have application tenant engineering on our end zone.
And the skewer is object that needs to have a name.
Then we have the kind and the properties for the storage account and their values are feeling from the parameters.
Next, let's at the information for the virtual network.
I'm just copy and paste it from my prepared values.
this time, the die, please
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.
So we typed the properties for the network, which are the other space in the sub nets.
Now let's take a look how we can clear the parameters file to use with these template.
The Perimeter's foul has a similar structure, like the template itself. And here's the schema in the content version,
and it has a big object called Parliamentary Is that contains all the parameters for the template?
let's feeling some of the parameters.
He'll have the location, storage account, name storage account type, storage kind in storage access steer, which are all string tie parameters
before Marty's, probably
then the next one is, ah, storage value,
bullion type of para matter. So you see that we're specifying the parameters us
just Jason values, whether their stink or bullion or some other types, as we'll see just shortly. Next, let's at the
virtual network name.
It is also a string type
And then we have the IRA types, which are the which virtual network. Others prefixes In the sub nets,
he discovered. You specify dolls
again. Simple Jason values.
So you, uh, the virtual network, others prefixes with the value array of prefixes
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.
Now we have our template, Jason in our parameters, Jason, that we can use for our deployment.
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
in the next lecture. We'll see how we can actually make these templates more flexible