{
    "id": "0f55b2ec-33fc-427b-91df-87e09242c2f2",
    "name": "Complex ARM Template Deployment",
    "slug": "complex-arm-template-deployment",
    "status": "published",
    "lab_type": "pta",
    "is_sample": false,
    "duration_in_seconds": 1800,
    "metadata": {
        "courses": [
            "1a20bc1a-9d44-4503-95f2-3de135097a2e",
            "0fafa2f2-99f0-42eb-98ff-a5f046da20e1"
        ],
        "pta_sdn": "142",
        "pta_namespace": "my.ine",
        "learning_paths": [],
        "has_published_parent": true
    },
    "session": null,
    "company": "a491bc32-c056-4946-9169-cc053387bada",
    "created": "2022-10-07T17:29:30.370684Z",
    "modified": "2023-10-03T18:58:26.833893Z",
    "is_beta": false,
    "lab_objectives": [],
    "main_learning_area": "d3f82c70-f4e7-428e-afd7-4b1d28988e18",
    "learning_areas": [
        {
            "id": "d3f82c70-f4e7-428e-afd7-4b1d28988e18",
            "name": "Cloud",
            "slug": "cloud"
        }
    ],
    "categories": [],
    "tags": [],
    "difficulty": null,
    "is_web_access": true,
    "is_lab_experience": false,
    "is_featured": false,
    "cve": null,
    "severity": null,
    "year": null,
    "classification": null,
    "is_trackable": false,
    "cpe_credits": null,
    "is_skill_check": false,
    "external_url": "",
    "solution_video": null,
    "explanation_video": null,
    "description": "The goal of this task is to create an ARM template that defines a virtual machine and all required resources. The template will be modified to produce multiple virtual machines. Modifications will include:\n\n- removing a dependency between the virtual machine and the storage account;\n- modifying variables to support multiple virtual machine instances;\n- adding data disks to the virtual machine; and\n- generating multiple copies of the virtual machine.\n\nA second goal of this task is to modify the template to add a Bastion host and re-deploy the template.",
    "description_html": "<p>The goal of this task is to create an ARM template that defines a virtual machine and all required resources. The template will be modified to produce multiple virtual machines. Modifications will include:</p>\n<ul>\n<li>removing a dependency between the virtual machine and the storage account;</li>\n<li>modifying variables to support multiple virtual machine instances;</li>\n<li>adding data disks to the virtual machine; and</li>\n<li>generating multiple copies of the virtual machine.</li>\n</ul>\n<p>A second goal of this task is to modify the template to add a Bastion host and re-deploy the template.</p>",
    "tasks": "",
    "tasks_html": "",
    "published_date": "2020-04-07T18:00:00Z",
    "solutions": "## Login to the Azure Portal\n\nClick on the login URL and enter the given credentials to login to the Azure portal.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/1.png)\n\n**Note:** Your credentials will be different from the one shown in the figure.\n\nAfter logging in to portal using the credentials. You will see an empty resource group, where you can create some resources.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/2.png)\n\n\n## Create an ARM Template for a virtual machine\n\nGo to the search box type \"template deployment\" and click on \"Deploy a custom template\".\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/3.png)\n\nNow click on \"Create a Windows virtual machine\".\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/4.png)\n\nAfter that click on the \"Edit template\"\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/5.png)\n\nNow here we will make some edits in our pre-defined template.\n\nFirst, navigate to the virtual machine section and set \"bootDiagnostics\" as false. And also remove the \"storageUri\" (portion selected in the below image) from the bootDiagnostics.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/6.png)\n\nSecond, remove the storage account dependency from the virtual machine. Delete the selected protion from the template in the \"dependsOn\" as shown in the below image.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/7.png)\n\nNow, go to the \"Variables\" section and remove the \"nicName\" variable.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/8.png)\n\nAdd another variable with name the \"baseNames\" and value equals [\"primary\", \"secondary\"]\n\n```\n\"baseNames\":[\"primary\",\"secondary\"]\n```\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/9.png)\n\n\n## Define multiple data disks for the virtual machine\n\n**NOTE: In this lab we are going to define just one data disk as defining multiple data disks will exceed the lab resources creation limit.**\n\nGo to the VM section and inside that search for the \"dataDisks\". Change the \"diskSizeGB\" to 10 as shown below.  \n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/10.png)\n\n## Create multiple instances of Azure resources with an ARM template\n\n\nGo to the \"Parameters\" section and remove the \"dnsLabelPrefix\" (selected part in the below image).\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/11.png)\n\n\nNow, go to the \"Variables\" section and add one variable with name \"copies\" and value equals 2.\n\n```\n\"copies\" : 2\n```\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/12.png)\n\nModify the public IP address element. Change the name to the one given below and also add the \"copy\" element. Also remove the \"dnsSettings\" from the properties (selected portion in the below image).\n\n```\n\"name\":\"[concat(variables('baseNames')[copyIndex()],'-pip')]\"\n\"copy\":{\n    \"name\": \"pipCopy\",\n    \"count\": \"[variables('copies')]\"\n}\n```\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/13.png)\n\n\nModify the network interface element. Change the name to the one given below and also add the \"copy\" element. Replace the dependsOn entry for the public ip address with \"pipCopy\".\n\n```\n\"name\":\"[concat(variables('baseNames')[copyIndex()],'-nic')]\"\n\"copy\":{\n    \"name\": \"nicCopy\",\n    \"count\": \"[variables('copies')]\"\n}\n```\n\n```\npipCopy\n```\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/14.png)\n\n\nReplace the properties/ipConfigurations/properties/publicIpAddress/id element with:\n\n```\n\"id\": \"[resourceId('Microsoft.Network/publicIPAddresses',concat(variables('baseNames')[copyIndex()],'-pip'))]\"\n```\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/15.png)\n\n\nModify the virtual machine element. Change the name to the one given below and also add the \"copy\" element.\n\n```\n\"name\":\"[concat(variables('baseNames')[copyIndex()],'-vm')]\"\n\"copy\":{\n    \"name\": \"vmCopy\",\n    \"count\": \"[variables('copies')]\"\n}\n```\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/16.png)\n\n\nReplace the dependsOn entry for the network interface with \"nicCopy\". Replace the properties/networkProfile/networkInterfaces/id element with:\n\n```\n\"id\": \"[resourceId('Microsoft.Network/networkInterfaces',concat(variables('baseNames')[copyIndex()],'-nic'))]\"\n```\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/17.png)\n\nRemove the hostName element from the outputs element.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/18.png)\n\nNow, your template should look something like this:\n\n```\n{\n    \"$schema\": \"https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#\",\n    \"contentVersion\": \"1.0.0.0\",\n    \"parameters\": {\n        \"adminUsername\": {\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"Username for the Virtual Machine.\"\n            }\n        },\n        \"adminPassword\": {\n            \"minLength\": 12,\n            \"type\": \"SecureString\",\n            \"metadata\": {\n                \"description\": \"Password for the Virtual Machine.\"\n            }\n        },\n        \"publicIpName\": {\n            \"defaultValue\": \"myPublicIP\",\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"Name for the Public IP used to access the Virtual Machine.\"\n            }\n        },\n        \"publicIPAllocationMethod\": {\n            \"defaultValue\": \"Dynamic\",\n            \"allowedValues\": [\n                \"Dynamic\",\n                \"Static\"\n            ],\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"Allocation method for the Public IP used to access the Virtual Machine.\"\n            }\n        },\n        \"publicIpSku\": {\n            \"defaultValue\": \"Basic\",\n            \"allowedValues\": [\n                \"Basic\",\n                \"Standard\"\n            ],\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"SKU for the Public IP used to access the Virtual Machine.\"\n            }\n        },\n        \"OSVersion\": {\n            \"defaultValue\": \"2022-datacenter-azure-edition-core\",\n            \"allowedValues\": [\n                \"2008-R2-SP1\",\n                \"2008-R2-SP1-smalldisk\",\n                \"2012-Datacenter\",\n                \"2012-datacenter-gensecond\",\n                \"2012-Datacenter-smalldisk\",\n                \"2012-datacenter-smalldisk-g2\",\n                \"2012-Datacenter-zhcn\",\n                \"2012-datacenter-zhcn-g2\",\n                \"2012-R2-Datacenter\",\n                \"2012-r2-datacenter-gensecond\",\n                \"2012-R2-Datacenter-smalldisk\",\n                \"2012-r2-datacenter-smalldisk-g2\",\n                \"2012-R2-Datacenter-zhcn\",\n                \"2012-r2-datacenter-zhcn-g2\",\n                \"2016-Datacenter\",\n                \"2016-datacenter-gensecond\",\n                \"2016-datacenter-gs\",\n                \"2016-Datacenter-Server-Core\",\n                \"2016-datacenter-server-core-g2\",\n                \"2016-Datacenter-Server-Core-smalldisk\",\n                \"2016-datacenter-server-core-smalldisk-g2\",\n                \"2016-Datacenter-smalldisk\",\n                \"2016-datacenter-smalldisk-g2\",\n                \"2016-Datacenter-with-Containers\",\n                \"2016-datacenter-with-containers-g2\",\n                \"2016-datacenter-with-containers-gs\",\n                \"2016-Datacenter-zhcn\",\n                \"2016-datacenter-zhcn-g2\",\n                \"2019-Datacenter\",\n                \"2019-Datacenter-Core\",\n                \"2019-datacenter-core-g2\",\n                \"2019-Datacenter-Core-smalldisk\",\n                \"2019-datacenter-core-smalldisk-g2\",\n                \"2019-Datacenter-Core-with-Containers\",\n                \"2019-datacenter-core-with-containers-g2\",\n                \"2019-Datacenter-Core-with-Containers-smalldisk\",\n                \"2019-datacenter-core-with-containers-smalldisk-g2\",\n                \"2019-datacenter-gensecond\",\n                \"2019-datacenter-gs\",\n                \"2019-Datacenter-smalldisk\",\n                \"2019-datacenter-smalldisk-g2\",\n                \"2019-Datacenter-with-Containers\",\n                \"2019-datacenter-with-containers-g2\",\n                \"2019-datacenter-with-containers-gs\",\n                \"2019-Datacenter-with-Containers-smalldisk\",\n                \"2019-datacenter-with-containers-smalldisk-g2\",\n                \"2019-Datacenter-zhcn\",\n                \"2019-datacenter-zhcn-g2\",\n                \"2022-datacenter\",\n                \"2022-datacenter-azure-edition\",\n                \"2022-datacenter-azure-edition-core\",\n                \"2022-datacenter-azure-edition-core-smalldisk\",\n                \"2022-datacenter-azure-edition-smalldisk\",\n                \"2022-datacenter-core\",\n                \"2022-datacenter-core-g2\",\n                \"2022-datacenter-core-smalldisk\",\n                \"2022-datacenter-core-smalldisk-g2\",\n                \"2022-datacenter-g2\",\n                \"2022-datacenter-smalldisk\",\n                \"2022-datacenter-smalldisk-g2\"\n            ],\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"The Windows version for the VM. This will pick a fully patched image of this given Windows version.\"\n            }\n        },\n        \"vmSize\": {\n            \"defaultValue\": \"Standard_D2s_v5\",\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"Size of the virtual machine.\"\n            }\n        },\n        \"location\": {\n            \"defaultValue\": \"[resourceGroup().location]\",\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"Location for all resources.\"\n            }\n        },\n        \"vmName\": {\n            \"defaultValue\": \"simple-vm\",\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"Name of the virtual machine.\"\n            }\n        }\n    },\n    \"variables\": {\n        \"baseNames\": [\n            \"primary\",\n            \"secondary\"\n        ],\n        \"storageAccountName\": \"[format('bootdiags{0}', uniqueString(resourceGroup().id))]\",\n        \"addressPrefix\": \"10.0.0.0/16\",\n        \"subnetName\": \"Subnet\",\n        \"subnetPrefix\": \"10.0.0.0/24\",\n        \"virtualNetworkName\": \"MyVNET\",\n        \"networkSecurityGroupName\": \"default-NSG\",\n        \"copies\": 2\n    },\n    \"resources\": [\n        {\n            \"type\": \"Microsoft.Storage/storageAccounts\",\n            \"apiVersion\": \"2021-04-01\",\n            \"name\": \"[variables('storageAccountName')]\",\n            \"location\": \"[parameters('location')]\",\n            \"sku\": {\n                \"name\": \"Standard_LRS\"\n            },\n            \"kind\": \"Storage\"\n        },\n        {\n            \"type\": \"Microsoft.Network/publicIPAddresses\",\n            \"apiVersion\": \"2021-02-01\",\n            \"name\": \"[concat(variables('baseNames')[copyIndex()],'-pip')]\",\n            \"location\": \"[parameters('location')]\",\n            \"sku\": {\n                \"name\": \"[parameters('publicIpSku')]\"\n            },\n            \"properties\": {\n                \"publicIPAllocationMethod\": \"[parameters('publicIPAllocationMethod')]\"\n            },\n            \"copy\": {\n                \"name\": \"pipCopy\",\n                \"count\": \"[variables('copies')]\"\n            }\n        },\n        {\n            \"type\": \"Microsoft.Network/networkSecurityGroups\",\n            \"apiVersion\": \"2021-02-01\",\n            \"name\": \"[variables('networkSecurityGroupName')]\",\n            \"location\": \"[parameters('location')]\",\n            \"properties\": {\n                \"securityRules\": [\n                    {\n                        \"name\": \"default-allow-3389\",\n                        \"properties\": {\n                            \"priority\": 1000,\n                            \"access\": \"Allow\",\n                            \"direction\": \"Inbound\",\n                            \"destinationPortRange\": \"3389\",\n                            \"protocol\": \"Tcp\",\n                            \"sourcePortRange\": \"*\",\n                            \"sourceAddressPrefix\": \"*\",\n                            \"destinationAddressPrefix\": \"*\"\n                        }\n                    }\n                ]\n            }\n        },\n        {\n            \"type\": \"Microsoft.Network/virtualNetworks\",\n            \"apiVersion\": \"2021-02-01\",\n            \"name\": \"[variables('virtualNetworkName')]\",\n            \"location\": \"[parameters('location')]\",\n            \"dependsOn\": [\n                \"[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]\"\n            ],\n            \"properties\": {\n                \"addressSpace\": {\n                    \"addressPrefixes\": [\n                        \"[variables('addressPrefix')]\"\n                    ]\n                },\n                \"subnets\": [\n                    {\n                        \"name\": \"[variables('subnetName')]\",\n                        \"properties\": {\n                            \"addressPrefix\": \"[variables('subnetPrefix')]\",\n                            \"networkSecurityGroup\": {\n                                \"id\": \"[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]\"\n                            }\n                        }\n                    }\n                ]\n            }\n        },\n        {\n            \"type\": \"Microsoft.Network/networkInterfaces\",\n            \"apiVersion\": \"2021-02-01\",\n            \"name\": \"[concat(variables('baseNames')[copyIndex()],'-nic')]\",\n            \"location\": \"[parameters('location')]\",\n            \"dependsOn\": [\n                \"pipCopy\",\n                \"[resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]\"\n            ],\n            \"properties\": {\n                \"ipConfigurations\": [\n                    {\n                        \"name\": \"ipconfig1\",\n                        \"properties\": {\n                            \"privateIPAllocationMethod\": \"Dynamic\",\n                            \"publicIPAddress\": {\n                                \"id\": \"[resourceId('Microsoft.Network/publicIPAddresses',concat(variables('baseNames')[copyIndex()],'-pip'))]\"\n                            },\n                            \"subnet\": {\n                                \"id\": \"[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetName'))]\"\n                            }\n                        }\n                    }\n                ]\n            },\n            \"copy\": {\n                \"name\": \"nicCopy\",\n                \"count\": \"[variables('copies')]\"\n            }\n        },\n        {\n            \"type\": \"Microsoft.Compute/virtualMachines\",\n            \"apiVersion\": \"2021-03-01\",\n            \"name\": \"[concat(variables('baseNames')[copyIndex()],'-vm')]\",\n            \"location\": \"[parameters('location')]\",\n            \"dependsOn\": [\n                \"nicCopy\"\n            ],\n            \"properties\": {\n                \"hardwareProfile\": {\n                    \"vmSize\": \"[parameters('vmSize')]\"\n                },\n                \"osProfile\": {\n                    \"computerName\": \"[parameters('vmName')]\",\n                    \"adminUsername\": \"[parameters('adminUsername')]\",\n                    \"adminPassword\": \"[parameters('adminPassword')]\"\n                },\n                \"storageProfile\": {\n                    \"imageReference\": {\n                        \"publisher\": \"MicrosoftWindowsServer\",\n                        \"offer\": \"WindowsServer\",\n                        \"sku\": \"[parameters('OSVersion')]\",\n                        \"version\": \"latest\"\n                    },\n                    \"osDisk\": {\n                        \"createOption\": \"FromImage\",\n                        \"managedDisk\": {\n                            \"storageAccountType\": \"StandardSSD_LRS\"\n                        }\n                    },\n                    \"dataDisks\": [\n                        {\n                            \"diskSizeGB\": 10,\n                            \"lun\": 0,\n                            \"createOption\": \"Empty\"\n                        }\n                    ]\n                },\n                \"networkProfile\": {\n                    \"networkInterfaces\": [\n                        {\n                            \"id\": \"[resourceId('Microsoft.Network/networkInterfaces',concat(variables('baseNames')[copyIndex()],'-nic'))]\"\n                        }\n                    ]\n                },\n                \"diagnosticsProfile\": {\n                    \"bootDiagnostics\": {\n                        \"enabled\": false\n                    }\n                }\n            },\n            \"copy\": {\n                \"name\": \"vmCopy\",\n                \"count\": \"[variables('copies')]\"\n            }\n        }\n    ],\n    \"outputs\": {}\n}\n```\n\n## Deploy the ARM template\n\nBefore deploying the template, save a copy of the template to your local machine. Save the template definition and use the following settings to deploy the resources:\n\n- Admin Username:\tstudent\n- Admin Password:\t\"strongP@ssword123\"\n- Windows OS Version:\t2016-Datacenter\n- Vm Size:\tStandard_D2S_V3\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/19.png)\n\n***NOTE: Do not try to create a new resource group, use the default (pre-defined) resource group for this lab.***\n\nNow, click on \"Create\" button.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/20.png)\n\nWait to some time to finish it deploying the resources. After that you will get \"Your deployment is complete\" message. \n\nNow, click on \"Go to resource group\" to view the resources.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/21.png)\n\nWe can see two virtual machines got created (\"primary-vm\", \"secondary-vm\").\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/22.png)\n\n## Update and re-deploy an ARM template\n\nClick on \"Deployments\" to view the deployment and select the newly created deployment (click on the deployment name).  \n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/23.png)\n\nNow, click on \"Template\" and click \"Download\" to download the old template before modifying it.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/24.png)\n\nNow, select \"Overview\" and click on \"Redeploy\" to redeploy the template.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/25.png)\n\nClick on \"Edit template\".\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/26.png)\n\nGo to the variables section and add the following variables.\n\n```\n\"bastionSubnetName\": \"AzureBastionSubnet\",\n\"bastionPrefix\": \"10.0.1.0/24\",\n\"bastionName\":\t\"tempadv-bastion\",\n\"bastionPipName\": \"tempadv-bastion-pip\",\n\"bastionSubnetId\":\t\"[resourceId('Microsoft.Network/virtualNetworks/subnets',variables('virtualNetworkName'),variables('bastionSubnetName'))]\",\n\"bastionPipId\":\t\"[resourceId('Microsoft.Network/publicIPAddresses',variables('bastionPipName'))]\"\n```\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/27.png)\n\nAdd the following json definition at the bottom of the resources element to provision a new public IP address:\n\n```\n{\n  \"name\": \"[variables('bastionPipName')]\",\n  \"type\": \"Microsoft.Network/publicIPAddresses\",\n  \"apiVersion\": \"2018-08-01\",\n  \"location\": \"[resourceGroup().location]\",\n  \"sku\": {\n      \"name\": \"Standard\"\n  },\n  \"properties\": {\n      \"publicIPAllocationMethod\": \"Static\"\n  }\n},\n```\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/28.png)\n\n\nAdd the following json definition at the bottom of the resources element to provision a new subnet:\n\n```\n{\n  \"apiVersion\": \"2019-02-01\",\n  \"type\": \"Microsoft.Network/virtualNetworks/subnets\",\n  \"name\": \"[concat(variables('virtualNetworkName'), '/', variables('bastionSubnetName'))]\",\n  \"location\": \"[resourceGroup().location]\",\n  \"dependsOn\": [\n      \"[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]\"\n  ],\n  \"properties\": {\n      \"addressPrefix\": \"[variables('bastionPrefix')]\"\n  }\n},\n```\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/29.png)\n\nAdd the following json definition at the bottom of the resources element to provision a new Bastion host:\n\n```\n{\n  \"apiVersion\": \"2018-10-01\",\n  \"type\": \"Microsoft.Network/bastionHosts\",\n  \"name\": \"[variables('bastionName')]\",\n      \"tags\":{\n      \"displayName\":\"OP Bastion Host\"\n  },\n  \"location\": \"[resourceGroup().location]\",\n  \"dependsOn\": [\n      \"[variables('bastionPipId')]\",\n      \"[variables('bastionSubnetId')]\"\n  ],\n  \"properties\": {\n      \"ipConfigurations\": [\n          {\n              \"name\": \"IpConf\",\n              \"properties\": {\n                  \"subnet\": {\n                      \"id\": \"[variables('bastionSubnetId')]\"\n                  },\n                  \"publicIPAddress\": {\n                      \"id\": \"[variables('bastionPipId')]\"\n                  }\n              }\n          }\n      ]\n  }\n}\n```\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/30.png)\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/31.png)\n\nNow click on \"Save\".\n\nYour final template should look something like this:\n\n```\n{\n    \"$schema\": \"https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#\",\n    \"contentVersion\": \"1.0.0.0\",\n    \"parameters\": {\n        \"adminUsername\": {\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"Username for the Virtual Machine.\"\n            }\n        },\n        \"adminPassword\": {\n            \"minLength\": 12,\n            \"type\": \"SecureString\",\n            \"metadata\": {\n                \"description\": \"Password for the Virtual Machine.\"\n            }\n        },\n        \"publicIpName\": {\n            \"defaultValue\": \"myPublicIP\",\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"Name for the Public IP used to access the Virtual Machine.\"\n            }\n        },\n        \"publicIPAllocationMethod\": {\n            \"defaultValue\": \"Dynamic\",\n            \"allowedValues\": [\n                \"Dynamic\",\n                \"Static\"\n            ],\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"Allocation method for the Public IP used to access the Virtual Machine.\"\n            }\n        },\n        \"publicIpSku\": {\n            \"defaultValue\": \"Basic\",\n            \"allowedValues\": [\n                \"Basic\",\n                \"Standard\"\n            ],\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"SKU for the Public IP used to access the Virtual Machine.\"\n            }\n        },\n        \"OSVersion\": {\n            \"defaultValue\": \"2022-datacenter-azure-edition-core\",\n            \"allowedValues\": [\n                \"2008-R2-SP1\",\n                \"2008-R2-SP1-smalldisk\",\n                \"2012-Datacenter\",\n                \"2012-datacenter-gensecond\",\n                \"2012-Datacenter-smalldisk\",\n                \"2012-datacenter-smalldisk-g2\",\n                \"2012-Datacenter-zhcn\",\n                \"2012-datacenter-zhcn-g2\",\n                \"2012-R2-Datacenter\",\n                \"2012-r2-datacenter-gensecond\",\n                \"2012-R2-Datacenter-smalldisk\",\n                \"2012-r2-datacenter-smalldisk-g2\",\n                \"2012-R2-Datacenter-zhcn\",\n                \"2012-r2-datacenter-zhcn-g2\",\n                \"2016-Datacenter\",\n                \"2016-datacenter-gensecond\",\n                \"2016-datacenter-gs\",\n                \"2016-Datacenter-Server-Core\",\n                \"2016-datacenter-server-core-g2\",\n                \"2016-Datacenter-Server-Core-smalldisk\",\n                \"2016-datacenter-server-core-smalldisk-g2\",\n                \"2016-Datacenter-smalldisk\",\n                \"2016-datacenter-smalldisk-g2\",\n                \"2016-Datacenter-with-Containers\",\n                \"2016-datacenter-with-containers-g2\",\n                \"2016-datacenter-with-containers-gs\",\n                \"2016-Datacenter-zhcn\",\n                \"2016-datacenter-zhcn-g2\",\n                \"2019-Datacenter\",\n                \"2019-Datacenter-Core\",\n                \"2019-datacenter-core-g2\",\n                \"2019-Datacenter-Core-smalldisk\",\n                \"2019-datacenter-core-smalldisk-g2\",\n                \"2019-Datacenter-Core-with-Containers\",\n                \"2019-datacenter-core-with-containers-g2\",\n                \"2019-Datacenter-Core-with-Containers-smalldisk\",\n                \"2019-datacenter-core-with-containers-smalldisk-g2\",\n                \"2019-datacenter-gensecond\",\n                \"2019-datacenter-gs\",\n                \"2019-Datacenter-smalldisk\",\n                \"2019-datacenter-smalldisk-g2\",\n                \"2019-Datacenter-with-Containers\",\n                \"2019-datacenter-with-containers-g2\",\n                \"2019-datacenter-with-containers-gs\",\n                \"2019-Datacenter-with-Containers-smalldisk\",\n                \"2019-datacenter-with-containers-smalldisk-g2\",\n                \"2019-Datacenter-zhcn\",\n                \"2019-datacenter-zhcn-g2\",\n                \"2022-datacenter\",\n                \"2022-datacenter-azure-edition\",\n                \"2022-datacenter-azure-edition-core\",\n                \"2022-datacenter-azure-edition-core-smalldisk\",\n                \"2022-datacenter-azure-edition-smalldisk\",\n                \"2022-datacenter-core\",\n                \"2022-datacenter-core-g2\",\n                \"2022-datacenter-core-smalldisk\",\n                \"2022-datacenter-core-smalldisk-g2\",\n                \"2022-datacenter-g2\",\n                \"2022-datacenter-smalldisk\",\n                \"2022-datacenter-smalldisk-g2\"\n            ],\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"The Windows version for the VM. This will pick a fully patched image of this given Windows version.\"\n            }\n        },\n        \"vmSize\": {\n            \"defaultValue\": \"Standard_D2s_v5\",\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"Size of the virtual machine.\"\n            }\n        },\n        \"location\": {\n            \"defaultValue\": \"[resourceGroup().location]\",\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"Location for all resources.\"\n            }\n        },\n        \"vmName\": {\n            \"defaultValue\": \"simple-vm\",\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"Name of the virtual machine.\"\n            }\n        }\n    },\n    \"variables\": {\n        \"baseNames\": [\n            \"primary\",\n            \"secondary\"\n        ],\n        \"storageAccountName\": \"[format('bootdiags{0}', uniqueString(resourceGroup().id))]\",\n        \"addressPrefix\": \"10.0.0.0/16\",\n        \"subnetName\": \"Subnet\",\n        \"subnetPrefix\": \"10.0.0.0/24\",\n        \"virtualNetworkName\": \"MyVNET\",\n        \"networkSecurityGroupName\": \"default-NSG\",\n        \"copies\": 2,\n        \"bastionSubnetName\": \"AzureBastionSubnet\",\n        \"bastionPrefix\": \"10.0.1.0/24\",\n        \"bastionName\": \"tempadv-bastion\",\n        \"bastionPipName\": \"tempadv-bastion-pip\",\n        \"bastionSubnetId\": \"[resourceId('Microsoft.Network/virtualNetworks/subnets',variables('virtualNetworkName'),variables('bastionSubnetName'))]\",\n        \"bastionPipId\": \"[resourceId('Microsoft.Network/publicIPAddresses',variables('bastionPipName'))]\"\n    },\n    \"resources\": [\n        {\n            \"type\": \"Microsoft.Storage/storageAccounts\",\n            \"apiVersion\": \"2021-04-01\",\n            \"name\": \"[variables('storageAccountName')]\",\n            \"location\": \"[parameters('location')]\",\n            \"sku\": {\n                \"name\": \"Standard_LRS\"\n            },\n            \"kind\": \"Storage\"\n        },\n        {\n            \"type\": \"Microsoft.Network/publicIPAddresses\",\n            \"apiVersion\": \"2021-02-01\",\n            \"name\": \"[concat(variables('baseNames')[copyIndex()],'-pip')]\",\n            \"location\": \"[parameters('location')]\",\n            \"sku\": {\n                \"name\": \"[parameters('publicIpSku')]\"\n            },\n            \"properties\": {\n                \"publicIPAllocationMethod\": \"[parameters('publicIPAllocationMethod')]\"\n            },\n            \"copy\": {\n                \"name\": \"pipCopy\",\n                \"count\": \"[variables('copies')]\"\n            }\n        },\n        {\n            \"type\": \"Microsoft.Network/networkSecurityGroups\",\n            \"apiVersion\": \"2021-02-01\",\n            \"name\": \"[variables('networkSecurityGroupName')]\",\n            \"location\": \"[parameters('location')]\",\n            \"properties\": {\n                \"securityRules\": [\n                    {\n                        \"name\": \"default-allow-3389\",\n                        \"properties\": {\n                            \"priority\": 1000,\n                            \"access\": \"Allow\",\n                            \"direction\": \"Inbound\",\n                            \"destinationPortRange\": \"3389\",\n                            \"protocol\": \"Tcp\",\n                            \"sourcePortRange\": \"*\",\n                            \"sourceAddressPrefix\": \"*\",\n                            \"destinationAddressPrefix\": \"*\"\n                        }\n                    }\n                ]\n            }\n        },\n        {\n            \"type\": \"Microsoft.Network/virtualNetworks\",\n            \"apiVersion\": \"2021-02-01\",\n            \"name\": \"[variables('virtualNetworkName')]\",\n            \"location\": \"[parameters('location')]\",\n            \"dependsOn\": [\n                \"[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]\"\n            ],\n            \"properties\": {\n                \"addressSpace\": {\n                    \"addressPrefixes\": [\n                        \"[variables('addressPrefix')]\"\n                    ]\n                },\n                \"subnets\": [\n                    {\n                        \"name\": \"[variables('subnetName')]\",\n                        \"properties\": {\n                            \"addressPrefix\": \"[variables('subnetPrefix')]\",\n                            \"networkSecurityGroup\": {\n                                \"id\": \"[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]\"\n                            }\n                        }\n                    }\n                ]\n            }\n        },\n        {\n            \"type\": \"Microsoft.Network/networkInterfaces\",\n            \"apiVersion\": \"2021-02-01\",\n            \"name\": \"[concat(variables('baseNames')[copyIndex()],'-nic')]\",\n            \"location\": \"[parameters('location')]\",\n            \"dependsOn\": [\n                \"pipCopy\",\n                \"[resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]\"\n            ],\n            \"properties\": {\n                \"ipConfigurations\": [\n                    {\n                        \"name\": \"ipconfig1\",\n                        \"properties\": {\n                            \"privateIPAllocationMethod\": \"Dynamic\",\n                            \"publicIPAddress\": {\n                                \"id\": \"[resourceId('Microsoft.Network/publicIPAddresses',concat(variables('baseNames')[copyIndex()],'-pip'))]\"\n                            },\n                            \"subnet\": {\n                                \"id\": \"[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetName'))]\"\n                            }\n                        }\n                    }\n                ]\n            },\n            \"copy\": {\n                \"name\": \"nicCopy\",\n                \"count\": \"[variables('copies')]\"\n            }\n        },\n        {\n            \"type\": \"Microsoft.Compute/virtualMachines\",\n            \"apiVersion\": \"2021-03-01\",\n            \"name\": \"[concat(variables('baseNames')[copyIndex()],'-vm')]\",\n            \"location\": \"[parameters('location')]\",\n            \"dependsOn\": [\n                \"nicCopy\"\n            ],\n            \"properties\": {\n                \"hardwareProfile\": {\n                    \"vmSize\": \"[parameters('vmSize')]\"\n                },\n                \"osProfile\": {\n                    \"computerName\": \"[parameters('vmName')]\",\n                    \"adminUsername\": \"[parameters('adminUsername')]\",\n                    \"adminPassword\": \"[parameters('adminPassword')]\"\n                },\n                \"storageProfile\": {\n                    \"imageReference\": {\n                        \"publisher\": \"MicrosoftWindowsServer\",\n                        \"offer\": \"WindowsServer\",\n                        \"sku\": \"[parameters('OSVersion')]\",\n                        \"version\": \"latest\"\n                    },\n                    \"osDisk\": {\n                        \"createOption\": \"FromImage\",\n                        \"managedDisk\": {\n                            \"storageAccountType\": \"StandardSSD_LRS\"\n                        }\n                    },\n                    \"dataDisks\": [\n                        {\n                            \"diskSizeGB\": 10,\n                            \"lun\": 0,\n                            \"createOption\": \"Empty\"\n                        }\n                    ]\n                },\n                \"networkProfile\": {\n                    \"networkInterfaces\": [\n                        {\n                            \"id\": \"[resourceId('Microsoft.Network/networkInterfaces',concat(variables('baseNames')[copyIndex()],'-nic'))]\"\n                        }\n                    ]\n                },\n                \"diagnosticsProfile\": {\n                    \"bootDiagnostics\": {\n                        \"enabled\": false\n                    }\n                }\n            },\n            \"copy\": {\n                \"name\": \"vmCopy\",\n                \"count\": \"[variables('copies')]\"\n            }\n        },\n        {\n            \"type\": \"Microsoft.Network/publicIPAddresses\",\n            \"apiVersion\": \"2018-08-01\",\n            \"name\": \"[variables('bastionPipName')]\",\n            \"location\": \"[resourceGroup().location]\",\n            \"sku\": {\n                \"name\": \"Standard\"\n            },\n            \"properties\": {\n                \"publicIPAllocationMethod\": \"Static\"\n            }\n        },\n        {\n            \"type\": \"Microsoft.Network/virtualNetworks/subnets\",\n            \"apiVersion\": \"2019-02-01\",\n            \"name\": \"[concat(variables('virtualNetworkName'), '/', variables('bastionSubnetName'))]\",\n            \"location\": \"[resourceGroup().location]\",\n            \"dependsOn\": [\n                \"[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]\"\n            ],\n            \"properties\": {\n                \"addressPrefix\": \"[variables('bastionPrefix')]\"\n            }\n        },\n        {\n            \"type\": \"Microsoft.Network/bastionHosts\",\n            \"apiVersion\": \"2018-10-01\",\n            \"name\": \"[variables('bastionName')]\",\n            \"location\": \"[resourceGroup().location]\",\n            \"dependsOn\": [\n                \"[variables('bastionPipId')]\",\n                \"[variables('bastionSubnetId')]\"\n            ],\n            \"tags\": {\n                \"displayName\": \"OP Bastion Host\"\n            },\n            \"properties\": {\n                \"ipConfigurations\": [\n                    {\n                        \"name\": \"IpConf\",\n                        \"properties\": {\n                            \"subnet\": {\n                                \"id\": \"[variables('bastionSubnetId')]\"\n                            },\n                            \"publicIPAddress\": {\n                                \"id\": \"[variables('bastionPipId')]\"\n                            }\n                        }\n                    }\n                ]\n            }\n        }\n    ],\n    \"outputs\": {}\n}\n```\n\nRe-deploy the template with the same parameter settings.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/32.png)\n\nClick on \"Review + create\".\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/33.png)\n\nClick on \"Create\".\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/34.png)\n\nWait for some time to finish it deploying.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/35.png)\n\nNow, the deployment is finished, click on \"Go to resource group\" to view resources.\n\nSelect the \"primary-vm\".\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/36.png)\n\nClick on connect and select \"Bastion\"\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/37.png)\n\n\nEnter the \"Username\" and \"Password\" that you used while deploying the template. \n\n- Username:\tstudent\n- Password:\t\"strongP@ssword123\"\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/38.png)\n\nNow, click on \"Connect\".\n\n![](https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/39.png)\n\nWe successfully got connected to a VM via Bastion host.\n\n**This lab is Now completed.**",
    "solutions_html": "<h2>Login to the Azure Portal</h2>\n<p>Click on the login URL and enter the given credentials to login to the Azure portal.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/1.png\" /></p>\n<p><strong>Note:</strong> Your credentials will be different from the one shown in the figure.</p>\n<p>After logging in to portal using the credentials. You will see an empty resource group, where you can create some resources.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/2.png\" /></p>\n<h2>Create an ARM Template for a virtual machine</h2>\n<p>Go to the search box type \"template deployment\" and click on \"Deploy a custom template\".</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/3.png\" /></p>\n<p>Now click on \"Create a Windows virtual machine\".</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/4.png\" /></p>\n<p>After that click on the \"Edit template\"</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/5.png\" /></p>\n<p>Now here we will make some edits in our pre-defined template.</p>\n<p>First, navigate to the virtual machine section and set \"bootDiagnostics\" as false. And also remove the \"storageUri\" (portion selected in the below image) from the bootDiagnostics.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/6.png\" /></p>\n<p>Second, remove the storage account dependency from the virtual machine. Delete the selected protion from the template in the \"dependsOn\" as shown in the below image.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/7.png\" /></p>\n<p>Now, go to the \"Variables\" section and remove the \"nicName\" variable.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/8.png\" /></p>\n<p>Add another variable with name the \"baseNames\" and value equals [\"primary\", \"secondary\"]</p>\n<pre class=\"codehilite\"><code>\"baseNames\":[\"primary\",\"secondary\"]</code></pre>\n\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/9.png\" /></p>\n<h2>Define multiple data disks for the virtual machine</h2>\n<p><strong>NOTE: In this lab we are going to define just one data disk as defining multiple data disks will exceed the lab resources creation limit.</strong></p>\n<p>Go to the VM section and inside that search for the \"dataDisks\". Change the \"diskSizeGB\" to 10 as shown below.  </p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/10.png\" /></p>\n<h2>Create multiple instances of Azure resources with an ARM template</h2>\n<p>Go to the \"Parameters\" section and remove the \"dnsLabelPrefix\" (selected part in the below image).</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/11.png\" /></p>\n<p>Now, go to the \"Variables\" section and add one variable with name \"copies\" and value equals 2.</p>\n<pre class=\"codehilite\"><code>\"copies\" : 2</code></pre>\n\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/12.png\" /></p>\n<p>Modify the public IP address element. Change the name to the one given below and also add the \"copy\" element. Also remove the \"dnsSettings\" from the properties (selected portion in the below image).</p>\n<pre class=\"codehilite\"><code>\"name\":\"[concat(variables('baseNames')[copyIndex()],'-pip')]\"\n\"copy\":{\n    \"name\": \"pipCopy\",\n    \"count\": \"[variables('copies')]\"\n}</code></pre>\n\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/13.png\" /></p>\n<p>Modify the network interface element. Change the name to the one given below and also add the \"copy\" element. Replace the dependsOn entry for the public ip address with \"pipCopy\".</p>\n<pre class=\"codehilite\"><code>\"name\":\"[concat(variables('baseNames')[copyIndex()],'-nic')]\"\n\"copy\":{\n    \"name\": \"nicCopy\",\n    \"count\": \"[variables('copies')]\"\n}</code></pre>\n\n<pre class=\"codehilite\"><code>pipCopy</code></pre>\n\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/14.png\" /></p>\n<p>Replace the properties/ipConfigurations/properties/publicIpAddress/id element with:</p>\n<pre class=\"codehilite\"><code>\"id\": \"[resourceId('Microsoft.Network/publicIPAddresses',concat(variables('baseNames')[copyIndex()],'-pip'))]\"</code></pre>\n\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/15.png\" /></p>\n<p>Modify the virtual machine element. Change the name to the one given below and also add the \"copy\" element.</p>\n<pre class=\"codehilite\"><code>\"name\":\"[concat(variables('baseNames')[copyIndex()],'-vm')]\"\n\"copy\":{\n    \"name\": \"vmCopy\",\n    \"count\": \"[variables('copies')]\"\n}</code></pre>\n\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/16.png\" /></p>\n<p>Replace the dependsOn entry for the network interface with \"nicCopy\". Replace the properties/networkProfile/networkInterfaces/id element with:</p>\n<pre class=\"codehilite\"><code>\"id\": \"[resourceId('Microsoft.Network/networkInterfaces',concat(variables('baseNames')[copyIndex()],'-nic'))]\"</code></pre>\n\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/17.png\" /></p>\n<p>Remove the hostName element from the outputs element.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/18.png\" /></p>\n<p>Now, your template should look something like this:</p>\n<pre class=\"codehilite\"><code>{\n    \"$schema\": \"https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#\",\n    \"contentVersion\": \"1.0.0.0\",\n    \"parameters\": {\n        \"adminUsername\": {\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"Username for the Virtual Machine.\"\n            }\n        },\n        \"adminPassword\": {\n            \"minLength\": 12,\n            \"type\": \"SecureString\",\n            \"metadata\": {\n                \"description\": \"Password for the Virtual Machine.\"\n            }\n        },\n        \"publicIpName\": {\n            \"defaultValue\": \"myPublicIP\",\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"Name for the Public IP used to access the Virtual Machine.\"\n            }\n        },\n        \"publicIPAllocationMethod\": {\n            \"defaultValue\": \"Dynamic\",\n            \"allowedValues\": [\n                \"Dynamic\",\n                \"Static\"\n            ],\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"Allocation method for the Public IP used to access the Virtual Machine.\"\n            }\n        },\n        \"publicIpSku\": {\n            \"defaultValue\": \"Basic\",\n            \"allowedValues\": [\n                \"Basic\",\n                \"Standard\"\n            ],\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"SKU for the Public IP used to access the Virtual Machine.\"\n            }\n        },\n        \"OSVersion\": {\n            \"defaultValue\": \"2022-datacenter-azure-edition-core\",\n            \"allowedValues\": [\n                \"2008-R2-SP1\",\n                \"2008-R2-SP1-smalldisk\",\n                \"2012-Datacenter\",\n                \"2012-datacenter-gensecond\",\n                \"2012-Datacenter-smalldisk\",\n                \"2012-datacenter-smalldisk-g2\",\n                \"2012-Datacenter-zhcn\",\n                \"2012-datacenter-zhcn-g2\",\n                \"2012-R2-Datacenter\",\n                \"2012-r2-datacenter-gensecond\",\n                \"2012-R2-Datacenter-smalldisk\",\n                \"2012-r2-datacenter-smalldisk-g2\",\n                \"2012-R2-Datacenter-zhcn\",\n                \"2012-r2-datacenter-zhcn-g2\",\n                \"2016-Datacenter\",\n                \"2016-datacenter-gensecond\",\n                \"2016-datacenter-gs\",\n                \"2016-Datacenter-Server-Core\",\n                \"2016-datacenter-server-core-g2\",\n                \"2016-Datacenter-Server-Core-smalldisk\",\n                \"2016-datacenter-server-core-smalldisk-g2\",\n                \"2016-Datacenter-smalldisk\",\n                \"2016-datacenter-smalldisk-g2\",\n                \"2016-Datacenter-with-Containers\",\n                \"2016-datacenter-with-containers-g2\",\n                \"2016-datacenter-with-containers-gs\",\n                \"2016-Datacenter-zhcn\",\n                \"2016-datacenter-zhcn-g2\",\n                \"2019-Datacenter\",\n                \"2019-Datacenter-Core\",\n                \"2019-datacenter-core-g2\",\n                \"2019-Datacenter-Core-smalldisk\",\n                \"2019-datacenter-core-smalldisk-g2\",\n                \"2019-Datacenter-Core-with-Containers\",\n                \"2019-datacenter-core-with-containers-g2\",\n                \"2019-Datacenter-Core-with-Containers-smalldisk\",\n                \"2019-datacenter-core-with-containers-smalldisk-g2\",\n                \"2019-datacenter-gensecond\",\n                \"2019-datacenter-gs\",\n                \"2019-Datacenter-smalldisk\",\n                \"2019-datacenter-smalldisk-g2\",\n                \"2019-Datacenter-with-Containers\",\n                \"2019-datacenter-with-containers-g2\",\n                \"2019-datacenter-with-containers-gs\",\n                \"2019-Datacenter-with-Containers-smalldisk\",\n                \"2019-datacenter-with-containers-smalldisk-g2\",\n                \"2019-Datacenter-zhcn\",\n                \"2019-datacenter-zhcn-g2\",\n                \"2022-datacenter\",\n                \"2022-datacenter-azure-edition\",\n                \"2022-datacenter-azure-edition-core\",\n                \"2022-datacenter-azure-edition-core-smalldisk\",\n                \"2022-datacenter-azure-edition-smalldisk\",\n                \"2022-datacenter-core\",\n                \"2022-datacenter-core-g2\",\n                \"2022-datacenter-core-smalldisk\",\n                \"2022-datacenter-core-smalldisk-g2\",\n                \"2022-datacenter-g2\",\n                \"2022-datacenter-smalldisk\",\n                \"2022-datacenter-smalldisk-g2\"\n            ],\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"The Windows version for the VM. This will pick a fully patched image of this given Windows version.\"\n            }\n        },\n        \"vmSize\": {\n            \"defaultValue\": \"Standard_D2s_v5\",\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"Size of the virtual machine.\"\n            }\n        },\n        \"location\": {\n            \"defaultValue\": \"[resourceGroup().location]\",\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"Location for all resources.\"\n            }\n        },\n        \"vmName\": {\n            \"defaultValue\": \"simple-vm\",\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"Name of the virtual machine.\"\n            }\n        }\n    },\n    \"variables\": {\n        \"baseNames\": [\n            \"primary\",\n            \"secondary\"\n        ],\n        \"storageAccountName\": \"[format('bootdiags{0}', uniqueString(resourceGroup().id))]\",\n        \"addressPrefix\": \"10.0.0.0/16\",\n        \"subnetName\": \"Subnet\",\n        \"subnetPrefix\": \"10.0.0.0/24\",\n        \"virtualNetworkName\": \"MyVNET\",\n        \"networkSecurityGroupName\": \"default-NSG\",\n        \"copies\": 2\n    },\n    \"resources\": [\n        {\n            \"type\": \"Microsoft.Storage/storageAccounts\",\n            \"apiVersion\": \"2021-04-01\",\n            \"name\": \"[variables('storageAccountName')]\",\n            \"location\": \"[parameters('location')]\",\n            \"sku\": {\n                \"name\": \"Standard_LRS\"\n            },\n            \"kind\": \"Storage\"\n        },\n        {\n            \"type\": \"Microsoft.Network/publicIPAddresses\",\n            \"apiVersion\": \"2021-02-01\",\n            \"name\": \"[concat(variables('baseNames')[copyIndex()],'-pip')]\",\n            \"location\": \"[parameters('location')]\",\n            \"sku\": {\n                \"name\": \"[parameters('publicIpSku')]\"\n            },\n            \"properties\": {\n                \"publicIPAllocationMethod\": \"[parameters('publicIPAllocationMethod')]\"\n            },\n            \"copy\": {\n                \"name\": \"pipCopy\",\n                \"count\": \"[variables('copies')]\"\n            }\n        },\n        {\n            \"type\": \"Microsoft.Network/networkSecurityGroups\",\n            \"apiVersion\": \"2021-02-01\",\n            \"name\": \"[variables('networkSecurityGroupName')]\",\n            \"location\": \"[parameters('location')]\",\n            \"properties\": {\n                \"securityRules\": [\n                    {\n                        \"name\": \"default-allow-3389\",\n                        \"properties\": {\n                            \"priority\": 1000,\n                            \"access\": \"Allow\",\n                            \"direction\": \"Inbound\",\n                            \"destinationPortRange\": \"3389\",\n                            \"protocol\": \"Tcp\",\n                            \"sourcePortRange\": \"*\",\n                            \"sourceAddressPrefix\": \"*\",\n                            \"destinationAddressPrefix\": \"*\"\n                        }\n                    }\n                ]\n            }\n        },\n        {\n            \"type\": \"Microsoft.Network/virtualNetworks\",\n            \"apiVersion\": \"2021-02-01\",\n            \"name\": \"[variables('virtualNetworkName')]\",\n            \"location\": \"[parameters('location')]\",\n            \"dependsOn\": [\n                \"[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]\"\n            ],\n            \"properties\": {\n                \"addressSpace\": {\n                    \"addressPrefixes\": [\n                        \"[variables('addressPrefix')]\"\n                    ]\n                },\n                \"subnets\": [\n                    {\n                        \"name\": \"[variables('subnetName')]\",\n                        \"properties\": {\n                            \"addressPrefix\": \"[variables('subnetPrefix')]\",\n                            \"networkSecurityGroup\": {\n                                \"id\": \"[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]\"\n                            }\n                        }\n                    }\n                ]\n            }\n        },\n        {\n            \"type\": \"Microsoft.Network/networkInterfaces\",\n            \"apiVersion\": \"2021-02-01\",\n            \"name\": \"[concat(variables('baseNames')[copyIndex()],'-nic')]\",\n            \"location\": \"[parameters('location')]\",\n            \"dependsOn\": [\n                \"pipCopy\",\n                \"[resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]\"\n            ],\n            \"properties\": {\n                \"ipConfigurations\": [\n                    {\n                        \"name\": \"ipconfig1\",\n                        \"properties\": {\n                            \"privateIPAllocationMethod\": \"Dynamic\",\n                            \"publicIPAddress\": {\n                                \"id\": \"[resourceId('Microsoft.Network/publicIPAddresses',concat(variables('baseNames')[copyIndex()],'-pip'))]\"\n                            },\n                            \"subnet\": {\n                                \"id\": \"[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetName'))]\"\n                            }\n                        }\n                    }\n                ]\n            },\n            \"copy\": {\n                \"name\": \"nicCopy\",\n                \"count\": \"[variables('copies')]\"\n            }\n        },\n        {\n            \"type\": \"Microsoft.Compute/virtualMachines\",\n            \"apiVersion\": \"2021-03-01\",\n            \"name\": \"[concat(variables('baseNames')[copyIndex()],'-vm')]\",\n            \"location\": \"[parameters('location')]\",\n            \"dependsOn\": [\n                \"nicCopy\"\n            ],\n            \"properties\": {\n                \"hardwareProfile\": {\n                    \"vmSize\": \"[parameters('vmSize')]\"\n                },\n                \"osProfile\": {\n                    \"computerName\": \"[parameters('vmName')]\",\n                    \"adminUsername\": \"[parameters('adminUsername')]\",\n                    \"adminPassword\": \"[parameters('adminPassword')]\"\n                },\n                \"storageProfile\": {\n                    \"imageReference\": {\n                        \"publisher\": \"MicrosoftWindowsServer\",\n                        \"offer\": \"WindowsServer\",\n                        \"sku\": \"[parameters('OSVersion')]\",\n                        \"version\": \"latest\"\n                    },\n                    \"osDisk\": {\n                        \"createOption\": \"FromImage\",\n                        \"managedDisk\": {\n                            \"storageAccountType\": \"StandardSSD_LRS\"\n                        }\n                    },\n                    \"dataDisks\": [\n                        {\n                            \"diskSizeGB\": 10,\n                            \"lun\": 0,\n                            \"createOption\": \"Empty\"\n                        }\n                    ]\n                },\n                \"networkProfile\": {\n                    \"networkInterfaces\": [\n                        {\n                            \"id\": \"[resourceId('Microsoft.Network/networkInterfaces',concat(variables('baseNames')[copyIndex()],'-nic'))]\"\n                        }\n                    ]\n                },\n                \"diagnosticsProfile\": {\n                    \"bootDiagnostics\": {\n                        \"enabled\": false\n                    }\n                }\n            },\n            \"copy\": {\n                \"name\": \"vmCopy\",\n                \"count\": \"[variables('copies')]\"\n            }\n        }\n    ],\n    \"outputs\": {}\n}</code></pre>\n\n<h2>Deploy the ARM template</h2>\n<p>Before deploying the template, save a copy of the template to your local machine. Save the template definition and use the following settings to deploy the resources:</p>\n<ul>\n<li>Admin Username:   student</li>\n<li>Admin Password:   \"strongP@ssword123\"</li>\n<li>Windows OS Version:   2016-Datacenter</li>\n<li>Vm Size:  Standard_D2S_V3</li>\n</ul>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/19.png\" /></p>\n<p><strong><em>NOTE: Do not try to create a new resource group, use the default (pre-defined) resource group for this lab.</em></strong></p>\n<p>Now, click on \"Create\" button.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/20.png\" /></p>\n<p>Wait to some time to finish it deploying the resources. After that you will get \"Your deployment is complete\" message. </p>\n<p>Now, click on \"Go to resource group\" to view the resources.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/21.png\" /></p>\n<p>We can see two virtual machines got created (\"primary-vm\", \"secondary-vm\").</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/22.png\" /></p>\n<h2>Update and re-deploy an ARM template</h2>\n<p>Click on \"Deployments\" to view the deployment and select the newly created deployment (click on the deployment name).  </p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/23.png\" /></p>\n<p>Now, click on \"Template\" and click \"Download\" to download the old template before modifying it.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/24.png\" /></p>\n<p>Now, select \"Overview\" and click on \"Redeploy\" to redeploy the template.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/25.png\" /></p>\n<p>Click on \"Edit template\".</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/26.png\" /></p>\n<p>Go to the variables section and add the following variables.</p>\n<pre class=\"codehilite\"><code>\"bastionSubnetName\": \"AzureBastionSubnet\",\n\"bastionPrefix\": \"10.0.1.0/24\",\n\"bastionName\":  \"tempadv-bastion\",\n\"bastionPipName\": \"tempadv-bastion-pip\",\n\"bastionSubnetId\":  \"[resourceId('Microsoft.Network/virtualNetworks/subnets',variables('virtualNetworkName'),variables('bastionSubnetName'))]\",\n\"bastionPipId\": \"[resourceId('Microsoft.Network/publicIPAddresses',variables('bastionPipName'))]\"</code></pre>\n\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/27.png\" /></p>\n<p>Add the following json definition at the bottom of the resources element to provision a new public IP address:</p>\n<pre class=\"codehilite\"><code>{\n  \"name\": \"[variables('bastionPipName')]\",\n  \"type\": \"Microsoft.Network/publicIPAddresses\",\n  \"apiVersion\": \"2018-08-01\",\n  \"location\": \"[resourceGroup().location]\",\n  \"sku\": {\n      \"name\": \"Standard\"\n  },\n  \"properties\": {\n      \"publicIPAllocationMethod\": \"Static\"\n  }\n},</code></pre>\n\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/28.png\" /></p>\n<p>Add the following json definition at the bottom of the resources element to provision a new subnet:</p>\n<pre class=\"codehilite\"><code>{\n  \"apiVersion\": \"2019-02-01\",\n  \"type\": \"Microsoft.Network/virtualNetworks/subnets\",\n  \"name\": \"[concat(variables('virtualNetworkName'), '/', variables('bastionSubnetName'))]\",\n  \"location\": \"[resourceGroup().location]\",\n  \"dependsOn\": [\n      \"[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]\"\n  ],\n  \"properties\": {\n      \"addressPrefix\": \"[variables('bastionPrefix')]\"\n  }\n},</code></pre>\n\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/29.png\" /></p>\n<p>Add the following json definition at the bottom of the resources element to provision a new Bastion host:</p>\n<pre class=\"codehilite\"><code>{\n  \"apiVersion\": \"2018-10-01\",\n  \"type\": \"Microsoft.Network/bastionHosts\",\n  \"name\": \"[variables('bastionName')]\",\n      \"tags\":{\n      \"displayName\":\"OP Bastion Host\"\n  },\n  \"location\": \"[resourceGroup().location]\",\n  \"dependsOn\": [\n      \"[variables('bastionPipId')]\",\n      \"[variables('bastionSubnetId')]\"\n  ],\n  \"properties\": {\n      \"ipConfigurations\": [\n          {\n              \"name\": \"IpConf\",\n              \"properties\": {\n                  \"subnet\": {\n                      \"id\": \"[variables('bastionSubnetId')]\"\n                  },\n                  \"publicIPAddress\": {\n                      \"id\": \"[variables('bastionPipId')]\"\n                  }\n              }\n          }\n      ]\n  }\n}</code></pre>\n\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/30.png\" /></p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/31.png\" /></p>\n<p>Now click on \"Save\".</p>\n<p>Your final template should look something like this:</p>\n<pre class=\"codehilite\"><code>{\n    \"$schema\": \"https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#\",\n    \"contentVersion\": \"1.0.0.0\",\n    \"parameters\": {\n        \"adminUsername\": {\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"Username for the Virtual Machine.\"\n            }\n        },\n        \"adminPassword\": {\n            \"minLength\": 12,\n            \"type\": \"SecureString\",\n            \"metadata\": {\n                \"description\": \"Password for the Virtual Machine.\"\n            }\n        },\n        \"publicIpName\": {\n            \"defaultValue\": \"myPublicIP\",\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"Name for the Public IP used to access the Virtual Machine.\"\n            }\n        },\n        \"publicIPAllocationMethod\": {\n            \"defaultValue\": \"Dynamic\",\n            \"allowedValues\": [\n                \"Dynamic\",\n                \"Static\"\n            ],\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"Allocation method for the Public IP used to access the Virtual Machine.\"\n            }\n        },\n        \"publicIpSku\": {\n            \"defaultValue\": \"Basic\",\n            \"allowedValues\": [\n                \"Basic\",\n                \"Standard\"\n            ],\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"SKU for the Public IP used to access the Virtual Machine.\"\n            }\n        },\n        \"OSVersion\": {\n            \"defaultValue\": \"2022-datacenter-azure-edition-core\",\n            \"allowedValues\": [\n                \"2008-R2-SP1\",\n                \"2008-R2-SP1-smalldisk\",\n                \"2012-Datacenter\",\n                \"2012-datacenter-gensecond\",\n                \"2012-Datacenter-smalldisk\",\n                \"2012-datacenter-smalldisk-g2\",\n                \"2012-Datacenter-zhcn\",\n                \"2012-datacenter-zhcn-g2\",\n                \"2012-R2-Datacenter\",\n                \"2012-r2-datacenter-gensecond\",\n                \"2012-R2-Datacenter-smalldisk\",\n                \"2012-r2-datacenter-smalldisk-g2\",\n                \"2012-R2-Datacenter-zhcn\",\n                \"2012-r2-datacenter-zhcn-g2\",\n                \"2016-Datacenter\",\n                \"2016-datacenter-gensecond\",\n                \"2016-datacenter-gs\",\n                \"2016-Datacenter-Server-Core\",\n                \"2016-datacenter-server-core-g2\",\n                \"2016-Datacenter-Server-Core-smalldisk\",\n                \"2016-datacenter-server-core-smalldisk-g2\",\n                \"2016-Datacenter-smalldisk\",\n                \"2016-datacenter-smalldisk-g2\",\n                \"2016-Datacenter-with-Containers\",\n                \"2016-datacenter-with-containers-g2\",\n                \"2016-datacenter-with-containers-gs\",\n                \"2016-Datacenter-zhcn\",\n                \"2016-datacenter-zhcn-g2\",\n                \"2019-Datacenter\",\n                \"2019-Datacenter-Core\",\n                \"2019-datacenter-core-g2\",\n                \"2019-Datacenter-Core-smalldisk\",\n                \"2019-datacenter-core-smalldisk-g2\",\n                \"2019-Datacenter-Core-with-Containers\",\n                \"2019-datacenter-core-with-containers-g2\",\n                \"2019-Datacenter-Core-with-Containers-smalldisk\",\n                \"2019-datacenter-core-with-containers-smalldisk-g2\",\n                \"2019-datacenter-gensecond\",\n                \"2019-datacenter-gs\",\n                \"2019-Datacenter-smalldisk\",\n                \"2019-datacenter-smalldisk-g2\",\n                \"2019-Datacenter-with-Containers\",\n                \"2019-datacenter-with-containers-g2\",\n                \"2019-datacenter-with-containers-gs\",\n                \"2019-Datacenter-with-Containers-smalldisk\",\n                \"2019-datacenter-with-containers-smalldisk-g2\",\n                \"2019-Datacenter-zhcn\",\n                \"2019-datacenter-zhcn-g2\",\n                \"2022-datacenter\",\n                \"2022-datacenter-azure-edition\",\n                \"2022-datacenter-azure-edition-core\",\n                \"2022-datacenter-azure-edition-core-smalldisk\",\n                \"2022-datacenter-azure-edition-smalldisk\",\n                \"2022-datacenter-core\",\n                \"2022-datacenter-core-g2\",\n                \"2022-datacenter-core-smalldisk\",\n                \"2022-datacenter-core-smalldisk-g2\",\n                \"2022-datacenter-g2\",\n                \"2022-datacenter-smalldisk\",\n                \"2022-datacenter-smalldisk-g2\"\n            ],\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"The Windows version for the VM. This will pick a fully patched image of this given Windows version.\"\n            }\n        },\n        \"vmSize\": {\n            \"defaultValue\": \"Standard_D2s_v5\",\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"Size of the virtual machine.\"\n            }\n        },\n        \"location\": {\n            \"defaultValue\": \"[resourceGroup().location]\",\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"Location for all resources.\"\n            }\n        },\n        \"vmName\": {\n            \"defaultValue\": \"simple-vm\",\n            \"type\": \"String\",\n            \"metadata\": {\n                \"description\": \"Name of the virtual machine.\"\n            }\n        }\n    },\n    \"variables\": {\n        \"baseNames\": [\n            \"primary\",\n            \"secondary\"\n        ],\n        \"storageAccountName\": \"[format('bootdiags{0}', uniqueString(resourceGroup().id))]\",\n        \"addressPrefix\": \"10.0.0.0/16\",\n        \"subnetName\": \"Subnet\",\n        \"subnetPrefix\": \"10.0.0.0/24\",\n        \"virtualNetworkName\": \"MyVNET\",\n        \"networkSecurityGroupName\": \"default-NSG\",\n        \"copies\": 2,\n        \"bastionSubnetName\": \"AzureBastionSubnet\",\n        \"bastionPrefix\": \"10.0.1.0/24\",\n        \"bastionName\": \"tempadv-bastion\",\n        \"bastionPipName\": \"tempadv-bastion-pip\",\n        \"bastionSubnetId\": \"[resourceId('Microsoft.Network/virtualNetworks/subnets',variables('virtualNetworkName'),variables('bastionSubnetName'))]\",\n        \"bastionPipId\": \"[resourceId('Microsoft.Network/publicIPAddresses',variables('bastionPipName'))]\"\n    },\n    \"resources\": [\n        {\n            \"type\": \"Microsoft.Storage/storageAccounts\",\n            \"apiVersion\": \"2021-04-01\",\n            \"name\": \"[variables('storageAccountName')]\",\n            \"location\": \"[parameters('location')]\",\n            \"sku\": {\n                \"name\": \"Standard_LRS\"\n            },\n            \"kind\": \"Storage\"\n        },\n        {\n            \"type\": \"Microsoft.Network/publicIPAddresses\",\n            \"apiVersion\": \"2021-02-01\",\n            \"name\": \"[concat(variables('baseNames')[copyIndex()],'-pip')]\",\n            \"location\": \"[parameters('location')]\",\n            \"sku\": {\n                \"name\": \"[parameters('publicIpSku')]\"\n            },\n            \"properties\": {\n                \"publicIPAllocationMethod\": \"[parameters('publicIPAllocationMethod')]\"\n            },\n            \"copy\": {\n                \"name\": \"pipCopy\",\n                \"count\": \"[variables('copies')]\"\n            }\n        },\n        {\n            \"type\": \"Microsoft.Network/networkSecurityGroups\",\n            \"apiVersion\": \"2021-02-01\",\n            \"name\": \"[variables('networkSecurityGroupName')]\",\n            \"location\": \"[parameters('location')]\",\n            \"properties\": {\n                \"securityRules\": [\n                    {\n                        \"name\": \"default-allow-3389\",\n                        \"properties\": {\n                            \"priority\": 1000,\n                            \"access\": \"Allow\",\n                            \"direction\": \"Inbound\",\n                            \"destinationPortRange\": \"3389\",\n                            \"protocol\": \"Tcp\",\n                            \"sourcePortRange\": \"*\",\n                            \"sourceAddressPrefix\": \"*\",\n                            \"destinationAddressPrefix\": \"*\"\n                        }\n                    }\n                ]\n            }\n        },\n        {\n            \"type\": \"Microsoft.Network/virtualNetworks\",\n            \"apiVersion\": \"2021-02-01\",\n            \"name\": \"[variables('virtualNetworkName')]\",\n            \"location\": \"[parameters('location')]\",\n            \"dependsOn\": [\n                \"[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]\"\n            ],\n            \"properties\": {\n                \"addressSpace\": {\n                    \"addressPrefixes\": [\n                        \"[variables('addressPrefix')]\"\n                    ]\n                },\n                \"subnets\": [\n                    {\n                        \"name\": \"[variables('subnetName')]\",\n                        \"properties\": {\n                            \"addressPrefix\": \"[variables('subnetPrefix')]\",\n                            \"networkSecurityGroup\": {\n                                \"id\": \"[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]\"\n                            }\n                        }\n                    }\n                ]\n            }\n        },\n        {\n            \"type\": \"Microsoft.Network/networkInterfaces\",\n            \"apiVersion\": \"2021-02-01\",\n            \"name\": \"[concat(variables('baseNames')[copyIndex()],'-nic')]\",\n            \"location\": \"[parameters('location')]\",\n            \"dependsOn\": [\n                \"pipCopy\",\n                \"[resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]\"\n            ],\n            \"properties\": {\n                \"ipConfigurations\": [\n                    {\n                        \"name\": \"ipconfig1\",\n                        \"properties\": {\n                            \"privateIPAllocationMethod\": \"Dynamic\",\n                            \"publicIPAddress\": {\n                                \"id\": \"[resourceId('Microsoft.Network/publicIPAddresses',concat(variables('baseNames')[copyIndex()],'-pip'))]\"\n                            },\n                            \"subnet\": {\n                                \"id\": \"[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetName'))]\"\n                            }\n                        }\n                    }\n                ]\n            },\n            \"copy\": {\n                \"name\": \"nicCopy\",\n                \"count\": \"[variables('copies')]\"\n            }\n        },\n        {\n            \"type\": \"Microsoft.Compute/virtualMachines\",\n            \"apiVersion\": \"2021-03-01\",\n            \"name\": \"[concat(variables('baseNames')[copyIndex()],'-vm')]\",\n            \"location\": \"[parameters('location')]\",\n            \"dependsOn\": [\n                \"nicCopy\"\n            ],\n            \"properties\": {\n                \"hardwareProfile\": {\n                    \"vmSize\": \"[parameters('vmSize')]\"\n                },\n                \"osProfile\": {\n                    \"computerName\": \"[parameters('vmName')]\",\n                    \"adminUsername\": \"[parameters('adminUsername')]\",\n                    \"adminPassword\": \"[parameters('adminPassword')]\"\n                },\n                \"storageProfile\": {\n                    \"imageReference\": {\n                        \"publisher\": \"MicrosoftWindowsServer\",\n                        \"offer\": \"WindowsServer\",\n                        \"sku\": \"[parameters('OSVersion')]\",\n                        \"version\": \"latest\"\n                    },\n                    \"osDisk\": {\n                        \"createOption\": \"FromImage\",\n                        \"managedDisk\": {\n                            \"storageAccountType\": \"StandardSSD_LRS\"\n                        }\n                    },\n                    \"dataDisks\": [\n                        {\n                            \"diskSizeGB\": 10,\n                            \"lun\": 0,\n                            \"createOption\": \"Empty\"\n                        }\n                    ]\n                },\n                \"networkProfile\": {\n                    \"networkInterfaces\": [\n                        {\n                            \"id\": \"[resourceId('Microsoft.Network/networkInterfaces',concat(variables('baseNames')[copyIndex()],'-nic'))]\"\n                        }\n                    ]\n                },\n                \"diagnosticsProfile\": {\n                    \"bootDiagnostics\": {\n                        \"enabled\": false\n                    }\n                }\n            },\n            \"copy\": {\n                \"name\": \"vmCopy\",\n                \"count\": \"[variables('copies')]\"\n            }\n        },\n        {\n            \"type\": \"Microsoft.Network/publicIPAddresses\",\n            \"apiVersion\": \"2018-08-01\",\n            \"name\": \"[variables('bastionPipName')]\",\n            \"location\": \"[resourceGroup().location]\",\n            \"sku\": {\n                \"name\": \"Standard\"\n            },\n            \"properties\": {\n                \"publicIPAllocationMethod\": \"Static\"\n            }\n        },\n        {\n            \"type\": \"Microsoft.Network/virtualNetworks/subnets\",\n            \"apiVersion\": \"2019-02-01\",\n            \"name\": \"[concat(variables('virtualNetworkName'), '/', variables('bastionSubnetName'))]\",\n            \"location\": \"[resourceGroup().location]\",\n            \"dependsOn\": [\n                \"[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]\"\n            ],\n            \"properties\": {\n                \"addressPrefix\": \"[variables('bastionPrefix')]\"\n            }\n        },\n        {\n            \"type\": \"Microsoft.Network/bastionHosts\",\n            \"apiVersion\": \"2018-10-01\",\n            \"name\": \"[variables('bastionName')]\",\n            \"location\": \"[resourceGroup().location]\",\n            \"dependsOn\": [\n                \"[variables('bastionPipId')]\",\n                \"[variables('bastionSubnetId')]\"\n            ],\n            \"tags\": {\n                \"displayName\": \"OP Bastion Host\"\n            },\n            \"properties\": {\n                \"ipConfigurations\": [\n                    {\n                        \"name\": \"IpConf\",\n                        \"properties\": {\n                            \"subnet\": {\n                                \"id\": \"[variables('bastionSubnetId')]\"\n                            },\n                            \"publicIPAddress\": {\n                                \"id\": \"[variables('bastionPipId')]\"\n                            }\n                        }\n                    }\n                ]\n            }\n        }\n    ],\n    \"outputs\": {}\n}</code></pre>\n\n<p>Re-deploy the template with the same parameter settings.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/32.png\" /></p>\n<p>Click on \"Review + create\".</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/33.png\" /></p>\n<p>Click on \"Create\".</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/34.png\" /></p>\n<p>Wait for some time to finish it deploying.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/35.png\" /></p>\n<p>Now, the deployment is finished, click on \"Go to resource group\" to view resources.</p>\n<p>Select the \"primary-vm\".</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/36.png\" /></p>\n<p>Click on connect and select \"Bastion\"</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/37.png\" /></p>\n<p>Enter the \"Username\" and \"Password\" that you used while deploying the template. </p>\n<ul>\n<li>Username: student</li>\n<li>Password: \"strongP@ssword123\"</li>\n</ul>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/38.png\" /></p>\n<p>Now, click on \"Connect\".</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/complex-arm-template-deployment/39.png\" /></p>\n<p>We successfully got connected to a VM via Bastion host.</p>\n<p><strong>This lab is Now completed.</strong></p>",
    "flags": [],
    "min_points_to_pass": null,
    "access_type": "web",
    "user_status": "unstarted",
    "user_lab_status": null,
    "user_status_modified": null,
    "user_flags": [],
    "global_running_session": null
}