Azure Classroom Series – 14/Feb/2021

Azure Resource Manager Templates

  • These are JSON files that define the infrastructure and configuration of your application.
  • These templates can be reused to create the same application cofiguration in different
    • resource groups
    • subscriptions
  • Consider the scenario where you need to deploy the following architecture into various environments (DEV, QA, STAGING, PRODUCTION) Preview
  • To solve this we need some kind of automation,
    • One approach will be to write a script using Azure CLI / Azure Powershell. The problem with this approach changing the script for any updates in architectures and changing values for resources like vm size, zone etc will be difficult to handle
    • Second approach is to create a template that defines the above architecture in json format and execute it on various environments.
  • ARM Templates provide us the following advantages
    • declarative syntax
    • Repeatable results
    • Orchestration
    • Modular files
    • Preview changes
    • Tracked deployments
  • Exercise:
    • Create one linux vm in a new resource group
    • After linux vm is created, add one windows vm to the same resource group Preview Preview Preview
    • Now navigate to the resource group section and select the created resource group Preview Preview
  • Azure is creating a template when we try to create resources.
  • In this section we will learn how to create an arm template,
  • To do this lets setup our developer environment
    • Ensure Azure CLI or Azure Powershell is installed on your machine Refer Here
    • Ensure Visual studio code is installed Preview

How are resources created in Azure

  • In your subscription, you will have resource providers Preview
  • Resource Provider in azure is capable of creating resources which it provides or offers
  • When we try to create any resource in Azure (from portal/cli/arm template)
    • It will check if the resource provider is registered or not
    • If the resource provider is not registered then it will throw error messages
    • If the resource provide is register then it will validate the values passed and if they are ok resources will be created.

ARM Template file

  • ARM Template has 5 sections
    • Parameters
    • Variables
    • User-defined functions
    • Resources
    • Outputs
  • The template format Refer Here
  "$schema": "",
  "contentVersion": "",
  "apiProfile": "",
  "parameters": {  },
  "variables": {  },
  "functions": [  ],
  "resources": [  ],
  "outputs": {  }
  • So the minimal arm template will be
  "$schema": "",
  "contentVersion": "",
  "resources": [  ]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner