Azure ARM

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

Video Transcription

00:01
Now let's look at how you can make your arm templates more flexible and reusable.
00:08
The first think will look at some restrictions that the arm time place here
00:14
you're limited to 256 parameters, 256 variables, 803 sources,
00:22
64 output values and 24,576 characters in a template expression.
00:30
However, you can overcome some of those limitations if you use Lincoln templates.
00:36
Also, if you need to have a lot of parameters and outputs, you can use objects and combine multiple parameters or outputs in a single object.
00:48
Here are some guidelines You should fall when you design arm templates.
00:53
Never hard cold secrets in the template.
00:56
One option is to use a secure string for Para matters when the secrets must be specified interactively.
01:03
Another is to use key vote and read the secrets from there.
01:07
Use the Ford values for para matters to simplify the input. One typical example. With location you can dynamically obtained the location from the resource group where the resource group are deported and only specified when the resource is vocation should be different.
01:25
Use very Abel's for values that you need to use more than once and are constructed using complex expressions.
01:32
One typical example was to use variables to enforce consistency. Naming
01:36
another is to construct the resource identifiers that you can use for dependencies.
01:42
Don't car called resource identifiers. If use the resource i d and the reference functions, you can make your templates independent of the subscription and the resource group. It is the point toe.
01:55
This makes it more flexible.
01:57
He's meta data to help other contributors to the template. Examples are the comments property of the Resource is or the meta data property of the Para matters.
02:07
Let's see how we can imply some of those guidelines to our template.
02:15
The first thing we'll do is at some default values for the parameters.
02:20
Let's start with the occasion. As you remember, we said that you can get the location from the resource group where the resources are the point. So if you type default value
02:30
inside square brackets, you can say resource group that location.
02:40
This way, you can obtain the resource group location and put it towards the perimeter for these template.
02:49
Next thing we can do is we cannot. Some other default values. Let's say the storage account type
02:55
and we will put for storage account type, standard
03:01
this
03:04
storage kind.
03:08
We will put
03:10
storage V two
03:14
and storage steer
03:16
both
03:21
we can, even at the Ford values that are not simple strings, Let's say our race, for example,
03:30
Here I'll just put the
03:32
D Ford fellow US array
03:36
for the address prefixes and the same thing I can do. Also, for the seven it's
03:51
the next thing will do in our template is to use some standard naming conventions. Isn't letting, for example, the user to type the storage account name and the virtual network name?
04:02
We would like to use some naming convention for that.
04:06
Let's say, for example, we would like to have naming convention that uses the up name, then it here's the environment, and at the end it has some so fix, which denotes the type of resource.
04:20
We'll remove the freeform parliamentary for virtual network name in storage account name
04:27
and well at new ones, and put some constraints on them. Let's say our first perimeter will be up
04:34
name
04:36
and we'll hear this type sprink also,
04:44
However,
04:46
we'll put Max length for this, and we'll say the length of the up name should not be more than eight characters.
04:56
The next thing we will do is we want some meta data
05:00
and description,
05:03
which will show up either when the prompt is asking for the perimeter input or in the Port O as a help desk, we can say this is
05:17
the application name Abbreviation
05:24
Limited toe eight characters.
05:29
So this is a careful task that can a text that can be used by tools us where waas other people working on the template,
05:38
the next part of matter that will at his environment.
05:44
And we'll say again, this is types drink
05:50
and we'll say, Max Lang is four characters
05:56
in that meta data description
06:01
to say
06:03
This is the environment
06:06
abbreviation
06:11
limited to four character,
06:15
and we'll put there.
06:19
They just brought in parent disease to give some idea what that means.
06:27
Now that we have our new partner mentors
06:30
east it using the storage account name as part of matter in the virtual network name Isparta matter will build the variables with those names storage account, name,
06:43
and this will be equal to
06:47
concatenation
06:49
off
06:54
the lower case of the platter. Mater, My up
07:00
or up name.
07:03
Then we'll let at the lower case of the environment
07:09
lower
07:14
uh, part of me too
07:17
environment.
07:21
And at the end, we'll just at the stink str for storage
07:29
this way. Our storage a canny our camp name will be standardized. It will have the up name, then the environment. Let's say death test or production and then str at the end
07:42
everything will be lower case. I will not have mixed case and will not rely on the user to type the proper case.
07:49
We can go see me were think with the virtual network name.
07:56
However virtual network names. They support not only alphanumeric characters but also dashes so we cannot dashes to the virtual network name.
08:09
I'll just copy the same thing
08:13
out Dash v. Net A specifics
08:16
and I also up another dash in between.
08:22
Now that we have our new partner matters and we build the standard names we need to go and in the resource section change the name for each resource toe. Not accept the para matter value but the very Able Bailey.
08:39
So we changed the name for the storage account and we change the name for the vitriol networks.
08:48
The next thing we will do is well at some output. In orderto do the output we need to reference the storage account.
08:58
Let's create a new valuable for the storage account idea.
09:05
This very able
09:11
can be built using the resource I D function
09:16
that is built into the arm templates.
09:20
In order to build our output,
09:22
we need to go at one additional property. Tow the output. Let's say that will be globe in 20
09:33
and,
09:35
well, type you Stipe stink for the end point. Okay, this will be the U. L that we can use to access Diane Point.
09:46
And for the value
09:48
we will say
09:52
it is a reference
09:58
toe. Very ables
10:01
and the valuable will be storage account i D.
10:07
And we'll use the 2019
10:13
0601 AP. I tow dough that reference
10:18
and we'll get the primary and point
10:22
for the blow up
10:24
This way. Once the storage account is created, we can output the end point for its blob
10:33
service.
10:35
You see how easy it is to generalize your templates and make them flexible.
10:39
Let's see how we can achieve even more flexibility with Linc templates

Up Next

Azure ARM

This Azure ARM course will 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