Azure Classroom Series – 14/Feb/2020

Exercise 4: Try to create 8 subnets in a vnet

Exercise 5: Try to make changes to exercise 4 script so that user can enter the location of VNET

  • In ARM Templates if you want to get the input from user that can be done with parameters
{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "0.0.0.1",
    "parameters": {
        "vnetlocation": {
            "type": "string",
            "defaultValue": "Central US"
        }
    },
    "resources": [
        {
            "name": "ntier",
            "type": "Microsoft.Network/virtualNetworks",
            "apiVersion": "2019-11-01",
            "location": "[parameters('vnetlocation')]",
            "properties": {
                "addressSpace": {
                    "addressPrefixes":["10.100.0.0/16"]
                },
                "subnets":[
                    {
                        "name": "web",
                        "properties":{
                            "addressPrefix": "10.100.0.0/24"
                        }
                    },
                    {
                        "name": "app",
                        "properties":{
                            "addressPrefix": "10.100.1.0/24"
                        }
                    },
                    {
                        "name": "db",
                        "properties":{
                            "addressPrefix": "10.100.2.0/24"
                        }
                    }   
                ]
            }
        },
        {
            "name": "ntier/management",
            "type": "Microsoft.Network/virtualNetworks/subnets",
            "apiVersion": "2019-11-01",
            "properties": {
                "addressPrefix": "10.100.3.0/24"
            },
            "dependsOn": [
                "ntier"
            ]   
        }
        ,
        {
            "name": "ntier/management1",
            "type": "Microsoft.Network/virtualNetworks/subnets",
            "apiVersion": "2019-11-01",
            "properties": {
                "addressPrefix": "10.100.4.0/24"
            },
            "dependsOn": [
                "ntier",
                "management"
            ]   
        }
        ,
        {
            "name": "ntier/management2",
            "type": "Microsoft.Network/virtualNetworks/subnets",
            "apiVersion": "2019-11-01",
            "properties": {
                "addressPrefix": "10.100.5.0/24"
            },
            "dependsOn": [
                "ntier",
                "management1"
            ]   
        }
        ,
        {
            "name": "ntier/management3",
            "type": "Microsoft.Network/virtualNetworks/subnets",
            "apiVersion": "2019-11-01",
            "properties": {
                "addressPrefix": "10.100.6.0/24"
            },
            "dependsOn": [
                "ntier",
                "management2"
            ]   
        }
        ,
        {
            "name": "ntier/management4",
            "type": "Microsoft.Network/virtualNetworks/subnets",
            "apiVersion": "2019-11-01",
            "properties": {
                "addressPrefix": "10.100.7.0/24"
            },
            "dependsOn": [
                "ntier",
                "management3"
            ]   
        }
    ]

}

Exercise 6: Try to take network name as an input from user

Leave a ReplyCancel reply

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

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company

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%%