Skip main navigation

Infrastructure as Code


In the previous steps, we gained a high-level understanding of provisioning and deprovisioning resources, environments and templated virtual machines. Here we are going to discuss Infrastructure as Code using Azure Resource Manager (ARM) templates.

If you are considering scaling your infrastructure and scaling your infrastructure on demand, Infrastructure as Code is important. Scaling infrastructure manually is complex and difficult to maintain.

Being able to provision your infrastructure from code means that if you run into server issues or other problems, you have a full back up available that allows you to provision your infrastructure from scratch.

Create a New Infrastructure Project with Azure Resource Manager Templates

To create a new infrastructure project with Azure Resource Manager Templates, follow these steps:

  1. From your build (in this video we refer to Summit Solution), right-click to add a new project. You will see a subcategory, Cloud.

  2. In your new project, you can select the Web App + SQL combination and click OK. This will produce some code within your project that you can use to specify the necessary parameters.

  3. In the Resources section that gives you all the resource that you will need. You will see that the code for a SQL Server and a website has automatically been added, but it also gives you predefined alerting rules.

  4. Now that your template is set up with the necessary parameters, you can commit your template to Source Control and create a build pipeline or a release phase that uses this template to provision your infrastructure for you.

Once your template is set up, you need to link your template with your build definition. To do so, you can navigate to Visual Studio Team Services. You will now some steps to your build definitions:

  1. First you can add the Azure Deploy Create task. This allows you to do Azure Cloud Service Deployment and Azure Resource Group Deployment. Azure Resource Group Deployment will allow you to allocate your template with resource definitions in it to your resource group.

  2. Next you can add an Azure PowerShell script. This has all the Azure APIs and modules available to it so that you can run Azure specific commands using this PowerShell script.

  3. The last task that you will add simply calls out the webserver name and the database name that it obtains from the script.

It is time to run the app and review the outputs.

Join the discussion

Have you tried to a new infrastructure project with Azure Resource Manager Templates? Have you gathered any insights from the outputs you reviewed after running the app?

Use the discussion section below and let us know your thoughts. Try to respond to at least one other post and once you’re happy with your contribution, click the Mark as complete button to check the step off, then you can move to the next step where we will explore Databased Deployments.

This article is from the free online

Microsoft Future Ready: Continuous Integration Implementation

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now