Chapter 20 Azure Resource Manager (ARM) Template

This Chapter covers following Topic Lessons

  • Azure Resource Manager (ARM) Template
  • Why we need ARM Template
  • Advantages of ARM Template
  • Disadvantage of ARM Template
  • Creating ARM template options
  • ARM Template Deployment Options
  • Viewing ARM Template

This Chapter covers following Lab Exercises

  • View ARM Template of an Existing Resource
  • Save a Template in library
  • Deploy or Edit Template

Chapter Topology

In this chapter we will add ARM Template to the Topology.

Screenshot_727

Azure Resource Manager (ARM) Template

ARM Templates are used to deploy resources using Infrastructure as a Code.

ARM Template is a text based JavaScript Object Notation (JSON) file that defines one or more resources to deploy to a resource group. It also defines the dependencies between the deployed resources. The template can be reused to deploy the resources consistently and repeatedly.

Templates are also created by MS and 3 rd parties. Figure below shows a sample ARM Template for Storage account creation.

Why we need ARM Template

Take an Example that you need to deploy a 3 tier application (Web/App/DB) in a new Virtual network. Internet user will connect to Web Tier, Web Tier will connect to App and App will connect to DB tier.

Using Azure Portal or Powershell we can deploy these resources one by one. To deploy we first need to create Virtual network and 3 subnets. Deploy VMs to these 3 subnets. Configure NSG on Subnets and VM NICs. There are following disadvantages to this approach:

  1. It is time consuming to deploy and configure the resources.
  2. It is error prone
  3. You require skilled resources for deployment.

Instead of above option of deploying resources individually we can create an ARM template once, specifying multiple resources and other configurations parameters for deployment. Using this ARM template you can now deploy multiple resources (VNET, Subnet, NSG & Virtual Machines) simultaneously. The ARM template can be re-used multiple times.

Advantages of ARM Template

  1. We can deploy, manage, and monitor all the resources for our solution as a group, rather than handling these resources individually.
  2. We can re-use the ARM template any number of times.
  3. Saves time.
  4. We can define the dependencies between resources so they are deployed in the correct order.

Disadvantage of ARM Template

  1. The biggest disadvantage of ARM Template is that you require engineering level skilled resource to create ARM Template.

Creating ARM template options

  1. Create an ARM Template from scratch using JSON.
  2. Download a template of a resource from Azure Portal and Edit it as per your requirement and then deploy it.

ARM Template Deployment Options

  1. PowerShell
  2. CLI
  3. Azure Portal

Viewing ARM Template of an Existing Resource

You can view Template of a resource using Export Template Tab in Resource Dashboard.

Exercise 173: View ARM Template of an Existing Resource

In this Exercise we will view Template of Virtual Machine VMFE2. VMFE2 was created in Chapter 2, Exercise 26.

  1. Go to VMFE2 Dashboard>In left pane Under Setting Click Export Template > In right pane you can see ARM template of VMFE2.

    Screenshot_729

Note the 3 options in Top right - Download, Add to library and Deploy.

Download : With this option you can download Template to your desktop.

Add to Library : With this option you can save the template in Library in Azure.

Deploy : With this option you can deploy the template to create a new Resource. In this case it will be Virtual Machine.

Exercise 174: Save a Template in library

In this lab we will save template of VM VMFE2 in Library in your Azure Account.

  1. In Azure Portal go to VMFE2 Dashboard>Click Export Template in left pane> In right pane you can see template.

    Screenshot_730
  2. Click Add to Library in Right pane>Save template blade opens> Enter a name VMFE2T and Enter Description>Click Save (Not shown).

    Screenshot_731
  3. Check the saved Template . In Azure Portal click All Services in left pane>All Services Blade opens>Click General>Note Templates option under General (2 nd from bottom).

    Screenshot_732
  4. Click Templates under General>All Templates blade opens>You can see the VMFE2T template.

    Screenshot_733

Exercise 175: Deploy or Edit Template

In this Exercise we will demonstrate deployment or Editing of Template. We will use the template vmfe2t which was saved in library in Previous Exercise.

  1. In Azure Portal click All Services in left pane>All Services Blade opens>Click Templates under General>All Templates Blade opens>Click Template vmfe2t>vmfe2 Template blade opens>Click View Template. Template opens in extreme right pane.

    Screenshot_734
  2. From here you can click deploy or edit the template to deploy a new VM or edit the existing template.

  3. Click deploy>Deploy from Custom Template pane opens. You can deploy a new VM here.

    Screenshot_735
UP

LIMITED OFFER: GET 30% Discount

This is ONE TIME OFFER

ExamSnap Discount Offer
Enter Your Email Address to Receive Your 30% Discount Code

A confirmation link will be sent to this email address to verify your login. *We value your privacy. We will not rent or sell your email address.

Download Free Demo of VCE Exam Simulator

Experience Avanset VCE Exam Simulator for yourself.

Simply submit your e-mail address below to get started with our interactive software demo of your free trial.

Free Demo Limits: In the demo version you will be able to access only first 5 questions from exam.