1 hour 19 minutes
Now let's see how we can use power shell toe. Deploy our arm template.
I will switch to my Tell me now and we'll get going.
The first thing we need to do so when we deport them plates using power shell is to authenticate with Asher.
You can do this with the following command. Let's connect
ese account. This will give you up you l
That's where was a colt that you need to paste in the browser in authenticate
I won't get the you out and the coat
base the called
signing with the count that we would like to authenticate with
and after that will be returned to Power Shell where we can perform any other operations With pleasure.
It gives you information about the count, the subscription name, the idea and the tenant i d.
Once you have authenticated
next because our arm template here's a resource group levels cop. We need to have a resource group created
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,
it's equal toe read Cost
front. Please enter the resource group name. When you do that,
power shell will prompt you to enter the resource group.
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
Power Shell research group.
We can do the same thing for location, however, are just assign a location. Very able us West. Us, too.
Now that we have our variables populated, let's go ahead and create the resource group.
The Commander for creation of a resource group is our new hazy resource group.
You need to specify the name
for the research group, which will be resource group. That's where was the location, which will be the location very able.
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.
Buddy, Able swear was the template file,
which will be our then played Jason
when we press enter,
the template will ask us for input. Our parameters were application name will you side very. For that
environment who used death upper case
And we need to also specify the weather. Want https traffic on the storage account? This will be true,
of course. Development off arm templates is very often a traveling error approach.
In this case, we made some mistake in the template. There is no function Kong cutie.
The actual name is Concha.
The only ways for you to go and figure out whether their problems with the templates is to try to deploy.
There is also the option. What if
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.
Sometimes it says, performing the operation, creating deployment on target.
Now let's go and fix our error in the coop and come back and deport this template.
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,
let's give it a try again without the want if option
cyber very death through.
And this time the template department will go through. It will take a little bit until the deployment is complete.
Our department is complete and we see the output from the deployment.
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
at the end. You see the outputs that we specified in the template. And this is the end point for the
blow up in the storage account that we wanted to have.
Not this one thing that our
naming conventions are enforced. So we have cyber very death. Str all lower case Although we specify deaf environment as all upper case,
let's take a look in the portal and see whether we have this resource group and the deployment there.
So we have the resource group. When we click on the resource group,
we can see that we have the boat, the storage account in the virtual network.
If you click on export template, you will see that inside there is the exact template that we have
We talked in the previous model how we can make our templates flexible and reusable.
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.
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.
In the production one, I would liketo change, for example,
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.
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
is equal to
deaf out of g,
I will create my Development resource group with new Pacey Resource Group. I'll specified the name which will be Deaf
Resource Group and then location will be location
and I will create a production resource group
with the name Cyber Be,
Propped RG and
I will create the Production resource Group.
Now let's do our deployments will use the Death Resource group name for our first deployment. So new ese resource group
in a resource group name that one
template file will be our temporary Jason and template parameter file will be our
bottom matters for the deaf deployment.
We have our development environment deport. As you can see,
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
the template perimeter fire will change it from parameters. Death toe perimeter sprout.
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
this is the case. So we have the death research group
where we have the
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.
Now you know how you can use power shell to deploy your arm templates.
Deploy Hybrid-Cloud Azure Solutions using ARM Templates
This IT Pro Challenge hands-on lab helps learners understand how to use the Azure Resource ...
Learn On Demand
Implement Azure Data Protection
This hands-on experience, an IT Pro Challenge, provides learners with resources to strengthen their knowledge ...
Learn On Demand