4.4 Deploying Azure Resources Using ARM and Azure DevOps
1 hour 19 minutes
we have seen how we can manually deploy arm templates from our machine.
We can use power shell or azure sea life. For that. However, the power of fashion resource manager is not doing my no deployments. It is using automation and setting up, continues integration and continues delivery pipelines that can use the arm templates to deploy infrastructure.
In this video, we'll see how we can set up as your develops toe deploy our infrastructure.
The first thing you need to do is you need to create the account for yourself in actual develops. I already have my account created, and also I have created my first project, which is cyber recourses.
This project will contain your arm scripts, your deployment templates, any other scripts or configuration that you need, and you'll use this project to trigger the pipelines.
Next, you need to connect your project. Tow the azure subscription where your deployments worker you go inside the project and you click on project settings.
There you see the service connections part, so please conserve these connections and you can create a new service connection. Thes service connection needs Toby, our show resource manager type.
It will ask you for the information.
I will not do that because I already have a connection,
but I have created previously.
Next thing is you need to have a depository where you can save the script.
I have, ah, cyber very arm depository
where I have all the scripts or deployment templates that I need. So I have the template that we created in the previous lectures. I also have the parameters files that we have created in the previous lectures, and we used for the manual deployments.
They're too new files inside that we need to look at.
Let's go to visual studio coat.
So what are those two new files? The 1st 1 is the Power Shell script that actually does some work for us.
This power shell script except street ings, a spotter matters the occasion, the up name and the environment. Those are the same things that we accept. Also in our own template.
The next thing that the Power Shell script does is it registers the resource providers for Microsoft Network and Microsoft storage, which are the resource is that we would like to create with our
What it also does is it creates a resource group based on some convention that we created. So the Resource group name
will have up named first. Then it will have the environment, and then it will have the fixed dash R g at the end. So we have a naming convention for the resource group. What this called here, this is it checks whether the resource group exists. If it doesn't exist, it creates it.
Next thing is great name for the deployment
and again we use some convention for that. So the name is deployment underscore. And then we get the date
and the time of the department.
And the last thing it does is actually triggers the deployment. Using the command let which is new azure resource group deployment the same thing that we did manually impose the information from the current folder and where the deployment
template this That's why Waas replaces the party matters far with the environment. So we pulled the correct parameters file.
We use a complete deployment bottom because
if there is something in the resource group already, we would like to remove it.
So this is the power shell script that will use to do our deployment.
The other file is actually a file that defines the pipeline. Normally, that's the foul was called Azure Dash pipelines, don't ya, Moe?
What it does is it creates a pool or build server with which uses Windows 2009 with Visual Studio 2019 and requires as your power shell.
Then we create a simple task inside the pipeline, which uses actual power shell task.
The name of the task is deploy armed template,
and what we do is we connect using the connection that we created Wash or our subscription
with the script that we have three ginning is deport template Power Shell, the one that we just looked on and we passed arguments, which our location West US up named Cyber Larry and Environment death.
Now let's go back to, Ah,
our develops project and go and configure the pipeline
so we'll click on Pipelines
and because we don't have any pipelines created, will click on you Pipeline.
We'll choose Asher git repositories.
Yeah, and we'll choose our show, our get depository, where we have our scripts and arm templates.
It automatically picks the GMO file that we have already created,
and we can just click run
so it takes a while until actually one agent becomes available. Sometimes it can take a couple of seconds. Sometimes it can take a little bit longer, like a minute.
Once the agent is available,
the job gets triggered and it goes through different faces. So the first thing is it. Initialize is the job, then checks out all the coat, and now it actually deploys the template and we will see that the template
gets the point. We'll see all the steps that we implemented in the Power Shell script.
It uses the connection it registers the providers,
creates the cyber very group. It tells us that it does not exist and creates a new one,
verifies the template
and creates the template. Deployment,
which is deployment, underscore the date and the time. This is the UTC time.
It takes a while until the resource is on Get deport. The bigger your template is, the more time it may take.
So as you can see the storage account, God created very fast. Let's switch to the
Porto. I will refresh here
and you'll see that we have the cyber very deaf resource group.
Both three sources are created
and we can look at the deployments
and we'll see that we have these departments which succeeded
going back to the pipeline. Everything succeeded.
So this is how you can howto make your resource deployments using Asher Dave ops.
The power of farm is not to trigger manual deployments, but to use automation toe deployed. All the resources that you need Actual tape ops is one way to do that. You can use our other C I C D tools like Travis C. I or Amazons, huh?
They've works and so on.
One important thing to note here is that I don't need to run this pipeline manually.
Every time a committee happens to the master branch, this pipeline will be run automatically in. The deployment will be done in Asher.
Now, you know how you can use azure develops toe, automate your deployment.