Azure Classroom notes 27/Dec/2023

Activity 4 (contd): Realize the below architecture in ARM

  • Reference architecture
    Preview
  • Refer Here for the changes to add the virtual machine
  • Create the necessary variables and parameters
    • parameter:
      • username
      • password
      • computer
    • variable:
      • image reference

Activity 5: Create a vnet with dynamic number of subnets

  • To create multiple resources use copy function Refer Here
  • refer below for the json
{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "subnetNames": {
            "type": "array",
            "metadata": {
                "description": "subnet names"
            },
            "defaultValue": ["ntier/web", "ntier/business", "ntier/data"]
        },
        "subnetRanges": {
            "type": "array",
            "metadata": {
                "description": "subnet ranges"
            }, 
            "defaultValue": ["10.100.0.0/24", "10.100.1.0/24", "10.100.2.0/24"]
        }
    },
    "functions": [],
    "variables": {},
    "resources": [
        {
            "name": "ntier",
            "type": "Microsoft.Network/virtualNetworks",
            "apiVersion": "2023-04-01",
            "location": "[resourceGroup().location]",
            "tags": {
                "displayName": "ntier"
            },
            "properties": {
                "addressSpace": {
                    "addressPrefixes": [
                        "10.100.0.0/16"
                    ]
                }
            }
        },
        {
            "type": "Microsoft.Network/virtualNetworks/subnets",
            "apiVersion": "2023-04-01",
            "name": "[parameters('subnetNames')[copyIndex()]]",
            "properties": {
                "addressPrefix": "[parameters('subnetRanges')[copyIndex()]]"
            },
            "copy": {
                "name": "subnetcopy",
                "count": "[length(parameters('subnetNames'))]",
                "mode": "Serial"
            },
            "dependsOn": [
                "[resourceId('Microsoft.Network/virtualNetworks','ntier')]"
            ]
        }

    ],
    "outputs": {}
}

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

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

Please turn AdBlock off
Animated Social Media Icons by Acurax Wordpress Development Company

Discover more from Direct DevOps from Quality Thought

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

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube