Azure Classroom Series – 25/Sept/2020

Getting Started with ARM Templates

  • Prereq’s:

    1. JSON
    2. Visual Studio Code
    3. Manual Creation of Resources
  • ARM Template file Structure Refer Here

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "",
  "apiProfile": "",
  "parameters": {  },
  "variables": {  },
  "functions": [  ],
  "resources": [  ],
  "outputs": {  }
}
  • The minimal ARM Template will have the following structure
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "",
  "resources": [  ]
}
  • Install ARM Tools extension in visual studio code Preview
  • So lets start with minimal version of it
    1. $schema
    2. contentVersion
    3. resources
  • The template as of now looks as
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "0.0.0.1",
    "resources": [

    ]

}
  • Now lets look at manual resource creation for the virtual network
  • Now Lets try to write an arm template which creates
    • ntier virtual network with 3 subnets Web, Business and Data
  • Resource Schema Refer Here
  • For resources selection, Follow the approach shown below Preview Preview Preview Preview Preview
  • The template written so far is
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "0.0.0.1",
    "resources": [
        {
            "name": "ntier",
            "type": "Microsoft.Network/virtualNetworks",
            "apiVersion": "2020-05-01",
            "location": "East US",
            "properties": {
                "addressSpace": {
                    "addressPrefixes": [ "192.168.0.0/16" ],
                    "subnets": [
                        {
                            "name": "WebSubnet",
                            "properties": {
                                "addressPrefix": "192.168.0.0/24"
                            }
                        },
                        {
                            "name": "AppSubnet",
                            "properties": {
                                "addressPrefix": "192.168.0.0/24"
                            }
                        },
                        {
                            "name": "DbSubnet",
                            "properties": {
                                "addressPrefix": "192.168.0.0/24"
                            }
                        }
                    ]
                }
            }


        }

    ]

}
  • Next steps:
    1. Validating & executing template

Leave a Reply

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

About learningthoughtsadmin