Azure Classroomnotes 25/Mar/2023

Infrastructure as Code (IaC)

  • In this approach we define infra as code i.e. infra need for applications will be declared.
  • We specify the desired state.
  • For IaC, Azure has two approaches supported natively
    • ARM Templates
    • Azure Bicep

Azure Resource Manager Templates (ARM Templates)

  • Here we define our infrastructure in JSON Format.
  • ARM Templates can be applied at (Scope)
    • Resource Group level
    • Subscription Level
    • Management Group level
  • ARM Template syntax: Refer Here for arm template syntax
  • Template skeleton
  "$schema": "",
  "contentVersion": "",
  "apiProfile": "",
  "parameters": {  },
  "variables": {  },
  "functions": [  ],
  "resources": [  ],
  "outputs": {  }
  • Required fields are $shema, content version and resources
  • contentVersion: This is version of arm template which we are authoring. Recommended versioning i.e.
  • $Schema:
    • subscription level:
    • resource group level:
    • management group level:
    • tenant level:
  • resources: This represents resources which we want to create using ARM Templates.

Intersting facts about ARM

  • Try creating vm using Azure portal and observe deployments
  • Azure creates arm template for the vm and all the related resources.

Activity 1: ARM Template to create Storage Account

  • Manual Steps:
    • Ensure you have a resource group
    • Refer Here for steps
  • ARM Ways of Working:
    • Deployment: Resource Group level
    • inputs:
      • storage account name
      • resource group name
    • Desired state: storage account
  • Setup:
    • Lets install ARM Tools extension into visual studio code Refer Here
  • For resource Refer Here
  • We have authored a template which looks as shown below
    "$schema": "",
    "contentVersion": "",
    "resources": [
            "name": "qtstorageaccfromarm",
            "type": "Microsoft.Storage/storageAccounts",
            "apiVersion": "2022-09-01",
            "location": "East US",
            "sku": {
                "name": "Standard_GRS"
            "kind": "StorageV2",
            "properties": {
                "accessTier": "Hot",
                "allowBlobPublicAccess": true
  • Now create a resource group armlearning and try deploying the template
  • Refer Here for changes

Activity2: ARM Template to create Vnet

  • Refer Here for azure docs to create a vnet
  • inputs:
    • vnet name
    • region
    • address space
    • subnet
      • subnet address space
  • create the deployment using the json. Refer Here for the changeset.
  • Exercise: Wirte ARM Template for the below case.

Leave a Reply

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

About continuous learner

devops & cloud enthusiastic learner