Azure Classroom notes 24/Dec/2023

Infra Provisioning using ARM Templates

  • Azure supports infraprovisioning in 3 popular ways
    • ARM Templates:
      • This is written in json
    • Azure Bicep
    • Azure Provider in Terraform
  • ARM Templates can be applied at resource group or subscription or management group level
  • Refer Here for creating an ARM Template from vscode
  • Ensure extenison is installed
  • resource definitins Refer Here
  • Template reference Refer Here
  • ARM Template resource syntax for virtual network Refer Here
  • Create a new folder and any json file. Add vnet as discussed in the class
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "resources": [
        {
            "type": "Microsoft.Network/virtualNetworks",
            "apiVersion": "2023-04-01",
            "name": "test",
            "location": "East US",
            "properties": {
                "addressSpace": {
                    "addressPrefixes": ["192.168.0.0/16"]
                }
            }
        }
    ]
}
  • Create a new resource group and deploy custom template



Activity 1: Create a storage account using ARM Template

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {},
    "functions": [],
    "variables": {},
    "resources": [
        {
            "type": "Microsoft.Storage/storageAccounts",
            "apiVersion": "2022-09-01",
            "name": "qtstorfromarmdec23",
            "location": "East US",
            "sku": {
                "name": "Standard_GZRS"
            },
            "kind": "StorageV2",
            "properties": {
                "accessTier": "Hot"
            }

        }
    ],
    "outputs": {}
}

Activity 2: Create vnet and storage account with parameters

  • Refer Here for parameter declaration
  • In the below template i have written two paramters
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "storageaccname": {
            "type": "string",
            "metadata": {
                "description": "name of the storage account"
            },
            "defaultValue": "qtstorfromarmdec23"
        },
        "sku": {
            "type": "string",
            "metadata": {
                "description": "sku of storage account"
            },
            "allowedValues": [
                "Premium_LRS",
                "Premium_ZRS",
                "Standard_GRS",
                "Standard_GZRS",
                "Standard_LRS",
                "Standard_RAGRS",
                "Standard_RAGZRS",
                "Standard_ZRS"
            ]
        }
    },
    "functions": [],
    "variables": {},
    "resources": [
        {
            "type": "Microsoft.Storage/storageAccounts",
            "apiVersion": "2022-09-01",
            "name": "[parameters('storageaccname')]",
            "location": "East US",
            "sku": {
                "name": "[parameters('sku')]"
            },
            "kind": "StorageV2",
            "properties": {
                "accessTier": "Hot"
            }

        },
        {
            "type": "Microsoft.Network/virtualNetworks",
            "apiVersion": "2023-04-01",
            "name": "test",
            "location": "East US",
            "properties": {
                "addressSpace": {
                    "addressPrefixes": [ "192.168.0.0/16" ]
                }
            }
        }
    ],
    "outputs": {}
}
  • Lets try deploying

Activity 3: Create a virtual network with 3 subnets in ARM Template

  • Create a virtual network with address space 10.100.0.0/16 and 3 subnets
    • web: 10.100.0.0/24
    • business: 10.100.1.0/24
    • data: 10.100.2.0/24
  • For ui references Refer Here
  • Note: ignore bastion host.
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a ReplyCancel reply

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

Please turn AdBlock off
Customized Social Media Icons from Acurax Digital Marketing Agency

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version
%%footer%%