ARM Template Basics
- For official docs from microsoft refer here
Structure
- Basic Structure of the template is as referred over here
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "",
"apiProfile": "",
"parameters": { },
"variables": { },
"functions": [ ],
"resources": [ ],
"outputs": { }
}
- Minimal template is a json file with
- $schema
- contentVersion
- resources
Writing ARM Templates
Editor Tools
- Visual Studio Code: Install Visual Studio Code
- Install Visual Studio Extension Azure Resource Manager Tools.
- If you prefer CLI deployments install azure cli and if the deployment has to be from Powershell install azure powershell.
Exercise-1
- Create a Storage Account using arm templates
- Create a resource group.
- Create a folder and create a json file (main.json) in that
- Now navigate to ARM Templates documentation from here
- Now the storage accounts latest api version (as on feb 11 2020) is here
- Try to Create the template
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "0.0.0.1",
"resources": [
{
"name": "qtarmstorageaccdemo",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2019-04-01",
"sku": {
"name": "Standard_RAGRS"
},
"kind": "StorageV2",
"location": "Central US",
"properties": {
"accessTier": "Hot"
}
}
]
}
- Now from portal, Navigate to Resoruce group, Click on Add and Enter Template Deployment
- Now the resource should be created as a result of the Deployment created by azure.
Exercise 2: Create a Virtual network with one subnet