4.2 Deploying Azure Resources Using ARM and PowerShell
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 »

Course
Difficulty
Beginner
Video Transcription
00:02
Now let's see how we can use power shell toe. Deploy our arm template.
00:07
I will switch to my Tell me now and we'll get going.
00:12
The first thing we need to do so when we deport them plates using power shell is to authenticate with Asher.
00:19
You can do this with the following command. Let's connect
00:23
ese account. This will give you up you l
00:28
That's where was a colt that you need to paste in the browser in authenticate
00:39
I won't get the you out and the coat
00:44
base the called
00:49
signing with the count that we would like to authenticate with
00:52
and after that will be returned to Power Shell where we can perform any other operations With pleasure.
01:00
It gives you information about the count, the subscription name, the idea and the tenant i d.
01:06
Once you have authenticated
01:10
next because our arm template here's a resource group levels cop. We need to have a resource group created
01:17
if you're developing a script powershell script, you can use prompts for the user toe. Enter information about the resource group and the location. You can do that by doing the following command lit. So resource group,
01:34
it's equal toe read Cost
01:41
front. Please enter the resource group name. When you do that,
01:52
power shell will prompt you to enter the resource group.
01:55
Of course, we are interactive right now, so that is not necessary. But if you ride the Power Shell script, it's better if you put this prompt. Let's say our resource group name will be Sy Berry
02:09
Dash,
02:10
this
02:14
Power Shell research group.
02:17
We can do the same thing for location, however, are just assign a location. Very able us West. Us, too.
02:30
Now that we have our variables populated, let's go ahead and create the resource group.
02:35
The Commander for creation of a resource group is our new hazy resource group.
02:45
You need to specify the name
02:47
for the research group, which will be resource group. That's where was the location, which will be the location very able.
03:00
So we have our resource group created. Now let's do the deployment. Tow this resource group. The commandment for deployment is New Casey Resource Group deployment. You need to specify the Resource Group name, which will be the research group.
03:22
Buddy, Able swear was the template file,
03:25
which will be our then played Jason
03:30
when we press enter,
03:34
the template will ask us for input. Our parameters were application name will you side very. For that
03:42
environment who used death upper case
03:46
And we need to also specify the weather. Want https traffic on the storage account? This will be true,
03:53
of course. Development off arm templates is very often a traveling error approach.
04:00
In this case, we made some mistake in the template. There is no function Kong cutie.
04:08
The actual name is Concha.
04:11
The only ways for you to go and figure out whether their problems with the templates is to try to deploy.
04:16
There is also the option. What if
04:20
in power share, which will give you some hints? Whether you can make whether your template is correct, However, they're not always very helpful.
04:32
Sometimes it says, performing the operation, creating deployment on target.
04:38
Now let's go and fix our error in the coop and come back and deport this template.
04:45
So our error is seen the variables creation, where we used the wrong name of the function Kong capped How? Just fix that, save it and go back to our term. Me now to continue with the deployment,
05:00
let's give it a try again without the want if option
05:04
cyber very death through.
05:11
And this time the template department will go through. It will take a little bit until the deployment is complete.
05:19
Our department is complete and we see the output from the deployment.
05:26
You see the information like deployment name. Which resource group is Waas? Deport Toe. What is the status and so on? You also see all the parameters that we specified
05:38
at the end. You see the outputs that we specified in the template. And this is the end point for the
05:46
blow up in the storage account that we wanted to have.
05:50
Not this one thing that our
05:54
naming conventions are enforced. So we have cyber very death. Str all lower case Although we specify deaf environment as all upper case,
06:04
let's take a look in the portal and see whether we have this resource group and the deployment there.
06:11
So we have the resource group. When we click on the resource group,
06:15
we can see that we have the boat, the storage account in the virtual network.
06:19
If you click on export template, you will see that inside there is the exact template that we have
06:28
specified.
06:30
We talked in the previous model how we can make our templates flexible and reusable.
06:38
Let's see how we can use the same template todo deport to different environments. Here I have a parameters Jason file, which is developed for development environment in another one, which is for the production environment.
06:54
In the development environment. I leave a lot of the parameters that are in the template by default because my template is optimized for the development environment. The only thing I need to specify is the up name and the environment.
07:11
In the production one, I would liketo change, for example,
07:15
the count type the storage account type Toby tohave redundancy and in this case will change it toe the zone redundant storage. And also, I would like to change the perfect size for the networks as well as the sub nets.
07:30
I will go and deport this template with the two different parameters. Jason files. The first thing I need to do is to create my resource group. I'll create one for my deaf environment and one for my test environment. So Deaf Resource group
07:48
is equal to
07:53
cyber,
07:56
um,
07:58
deaf out of g,
08:00
I will create my Development resource group with new Pacey Resource Group. I'll specified the name which will be Deaf
08:13
Resource Group and then location will be location
08:22
and I will create a production resource group
08:28
with the name Cyber Be,
08:33
um
08:35
Propped RG and
08:39
I will create the Production resource Group.
08:50
Now let's do our deployments will use the Death Resource group name for our first deployment. So new ese resource group
09:01
deployment
09:03
in a resource group name that one
09:09
template file will be our temporary Jason and template parameter file will be our
09:20
bottom matters for the deaf deployment.
09:24
We have our development environment deport. As you can see,
09:28
it uses the death naming conventions. We can do the same thing for the production one. The only thing that we need to change is the name of the resource group. So we'll change it from Death row product
09:41
and
09:43
the template perimeter fire will change it from parameters. Death toe perimeter sprout.
09:52
As you can see, we use the same template, tow the point to different environments, just passing separate para matters. Let's switch to the Port au and verify that
10:03
this is the case. So we have the death research group
10:09
where we have the
10:11
their storage in that they've in it. And we have the production resource group where we have the production storage in the production. Jeanette.
10:20
Now you know how you can use power shell to deploy your arm templates.
Up Next
4.3 Deploying Azure Resources Using ARM and Azure CLI
4.4 Deploying Azure Resources Using ARM and Azure DevOps
4.5 Module 4 Summary
5.1 Course Summary
Instructed By
Similar Content