{"id":97444,"date":"2024-09-19T15:44:43","date_gmt":"2024-09-19T10:14:43","guid":{"rendered":"https:\/\/www.whizlabs.com\/blog\/?p=97444"},"modified":"2024-09-20T16:03:24","modified_gmt":"2024-09-20T10:33:24","slug":"optimizing-azure-deployments-arm-templates","status":"publish","type":"post","link":"https:\/\/www.whizlabs.com\/blog\/optimizing-azure-deployments-arm-templates\/","title":{"rendered":"Optimizing Azure Deployments Using ARM Templates"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">In this blog post, we will look into <\/span><b>Optimizing Azure Deployments Using ARM Templates<\/b><span style=\"font-weight: 400;\"> and understand how to deploy an ARM template using Azure CLI. We will explore a live scenario to give you hands-on experience in deploying resources in Azure, helping you grasp the practical aspects of optimizing and automating your deployments efficiently.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">ARM templates are design documents created in JSON file format and are used in the Azure Resource Manager to outline how the resources in Azure will be structured and used. Therefore, these templates allow resources to be deployed and maintained in a repeatable manner with assurance of exactly what state will be deployed based on the infrastructure designed.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">For those preparing for the <\/span><a href=\"https:\/\/www.whizlabs.com\/microsoft-azure-certification-az-104\/\" target=\"_blank\" rel=\"noopener\"><b>Microsoft Azure Administrator AZ-104 Course<\/b><\/a><span style=\"font-weight: 400;\">, becoming proficient in ARM templates is essential. This certification course covers a wide range of Azure administrative tasks, including deploying and managing Azure resources.\u00a0<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">Advantages of the ARM Templates<\/span><\/h3>\n<p><strong>Infrastructure as Code (IaC):<\/strong><\/p>\n<p><span style=\"font-weight: 400;\">ARM Templates allow the users to create a blueprint of their structure and manage it on the Azure Cloud environment in the form of code. This way, features such as versioning ability, testing, or even collaboration can be facilitated making sure that the structure is more reliable and consistent.<\/span><\/p>\n<p><strong>Repeatability and Consistency:<\/strong><\/p>\n<p><span style=\"font-weight: 400;\">However, with the use of ARM Templates, the same environment with the same configuration if required can be deployed any number of times thus decreasing the chances of human error and other flawless chances in the deployments.<\/span><\/p>\n<p><strong>Easier Administration:<\/strong><\/p>\n<p><span style=\"font-weight: 400;\">The deployment of resources is synchronized through ARM Templates making it possible for the infrastructure to be monitored, updated, or managed as a whole. This majorly cuts down the complications associated with large-scale deployments.<\/span><\/p>\n<p><strong>Managing Dependencies:<\/strong><\/p>\n<p><span style=\"font-weight: 400;\">In particular, ARM Templates are capable of installing resources in a focused order as defined by the dependencies for the resources. This guarantees that all the resources are rolled out in the correct order without any manual planning.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>Collaboration with CI\/CD Pipelines<\/strong>:\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">It is possible to include ARM templates in the course of building <\/span><a href=\"https:\/\/www.whizlabs.com\/blog\/ci-cd-pipelines\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">Continuous Integration\/Continuous Deployment (CI\/CD)<\/span><\/a><span style=\"font-weight: 400;\"> lifecycle processes. This means that whenever there are changes to the necessary infrastructure in the cloud platform, automating those changes can be done.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><strong>Scalability<\/strong>:\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">At the same time, it is relatively easy to deploy an ARM Template for a complex architecture with many resources; over time, one can easily run more ARM Templates around that baseline.<\/span><\/p>\n<p><b>Structure of an ARM Template\u00a0<\/b><\/p>\n<p><span style=\"font-weight: 400;\">The file of the ARM Templates contains several pairings of richly detailed key-value sets in the form of JSON. For instance, below, you can see a format of ARM Templates\u00a0<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">{ \u201c$schema\u201d: \u201c<\/span><span style=\"font-weight: 400;\">https:\/\/schema.management.azure.com\/schemas\/2024-09-03\/deploymentTemplate.json#\u201d<\/span><span style=\"font-weight: 400;\">, \u201ccontent version\u201d: \u201c1.0.0\u201d, \u201cparameters\u201d:{}, \u201cvariables\u201d: {}, \u201cfunctions\u201d:[], \u201cresources\u201d: [], \u201coutputs\u201d:{} } <\/span><\/pre>\n<p><span style=\"font-size: 16px; font-weight: 400;\">1. <strong>Schema:<\/strong>\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The schema defines from where the schema information of the template is taken and this is used in template validation.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\"> 2. <\/span><strong><span style=\"font-size: 16px;\">Content Version:<\/span><\/strong><\/p>\n<p><span style=\"font-weight: 400;\">The content version specifies the version of the template. Tracking changes and ensuring consistency across various versions of the template becomes much easier with this approach.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">3. <strong>Parameters:<\/strong><\/span><\/p>\n<p><span style=\"font-weight: 400;\">This section allows you to define the inputs that can be provided at deployment time. This makes the template more flexible and reusable across different environments. Below is an example of parameters that allow users to specify the type of storage account they want to deploy in Azure.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">{<\/span>\r\n<span style=\"font-weight: 400;\">\"parameters\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"storageAccountType\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"type\": \"string\",<\/span>\r\n<span style=\"font-weight: 400;\">\"defaultValue\": \"Standard_LRS\",<\/span>\r\n<span style=\"font-weight: 400;\">\"allowed values\": [<\/span>\r\n<span style=\"font-weight: 400;\">\"Standard_LRS\",<\/span>\r\n<span style=\"font-weight: 400;\">\"Standard_GRS\",<\/span>\r\n<span style=\"font-weight: 400;\">\"Standard_RAGRS\",<\/span>\r\n<span style=\"font-weight: 400;\">\"Premium_LRS\"<\/span>\r\n<span style=\"font-weight: 400;\">],<\/span>\r\n<span style=\"font-weight: 400;\">\"metadata\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"description\": \"Storage Account type\"<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">4. <strong>Variables:<\/strong><\/span><br \/>\n<span style=\"font-weight: 400;\">The variables section defines values that can be reused throughout the template. Unlike parameters, these are calculated within the template and cannot be provided during deployment.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">{<\/span>\r\n<span style=\"font-weight: 400;\">\"variables\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"storageAccountName\": \"[concat('storage', uniqueString(resourceGroup().id))]\"<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">5. <strong>Functions:<\/strong><\/span><\/p>\n<p><span style=\"font-weight: 400;\">In a template, the function contains the steps and procedures to be followed. It is just like a variable that defines the steps performed when called in templates. The below example of the function defines the unique name for the resources.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">6. <strong>Resources:<\/strong><\/span><\/p>\n<p><span style=\"font-weight: 400;\">The resources section is the most critical part of the ARM Template. It defines the Azure resources to be deployed, including their properties, configurations, and dependencies.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">{<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\"resources\": [<\/span>\r\n<span style=\"font-weight: 400;\">{<\/span>\r\n<span style=\"font-weight: 400;\">\"type\": \"Microsoft.Storage\/storageAccounts\",<\/span>\r\n<span style=\"font-weight: 400;\">\"apiVersion\": \"2024-09-03\",<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\"name\": \"[variables('storageAccountName')]\",<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\"location\": \"[resourceGroup().location]\",<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\"sku\": {<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\"name\": \"[parameters('storageAccountType')]\"<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0},<\/span>\r\n<span style=\"font-weight: 400;\">\"kind\": \"StorageV2\",<\/span>\r\n<span style=\"font-weight: 400;\">\"properties\": {}<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">]<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">1.<strong> Outputs:<\/strong><\/span><\/p>\n<p><span style=\"font-weight: 400;\">The outputs section is used for value returns once the deployment is complete. This may feature the resource IDs, Connection strings or useful information as post-deployment operations.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">{<\/span>\r\n<span style=\"font-weight: 400;\">\u201coutputs\u201d: {<\/span>\r\n<span style=\"font-weight: 400;\">\u201cstorageAccountConnectionString\u201d: {<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u201ctype\u201d: \u201cstring,\u201d<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u201cvalue\u201d: \u201c[listKeys(resourceId(Microsoft.Storage\/storageAccounts\u2019, variables(\u2018storageAccountName\u2019), \u20182024-09-03\u2019) \u2018.keys[0].value]\u201d<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0}<\/span>\r\n<span style=\"font-weight: 400;\">Copy<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><b>Azure Quickstart templates<\/b><\/p>\n<p><span style=\"font-weight: 400;\">It is a repository of pre-created Azure resource manager arm templates available from Microsoft. The purpose of these templates is to ease the deployment of the said infrastructure of any applications on azure.<\/span><\/p>\n<p><b>Deployment of ARM Templates using Azure CLI<\/b><\/p>\n<p><span style=\"font-weight: 400;\">For the hands-on part of this tutorial, <span class=\"ui-provider a b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak\" dir=\"ltr\">you will need to login to our <a href=\"https:\/\/www.whizlabs.com\/\" target=\"_blank\" rel=\"noopener\">Whizlabs Website<\/a> using your credentials (Email ID and Password).<\/span><\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-97465 size-large\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/whizlabs-webiste-login-1024x590.webp\" alt=\"whizlabs-webiste-login\" width=\"1024\" height=\"590\" \/><\/p>\n<p><span style=\"font-weight: 400;\">Click on the Training Library panel, select Cloud Computing, Microsoft Azure, and Microsoft Azure Exam AZ-104 Course.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><img decoding=\"async\" class=\"aligncenter wp-image-97464 size-large\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/whizlabs-training-library-platform-1024x587.webp\" alt=\"whizlabs-training-library-platform\" width=\"1024\" height=\"587\" \/><\/span><\/p>\n<p><span style=\"font-weight: 400;\">You will be redirected into AZ-104 Azure Administrator Associate Course. Select the Hands-on lab button to be taken into Hands-on Lab Page.<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-97449 size-large\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/az-104-microsoft-azure-administrator-1024x589.webp\" alt=\" az-104-microsoft-azure-administrator\" width=\"1024\" height=\"589\" srcset=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/az-104-microsoft-azure-administrator-1024x589.webp 1024w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/az-104-microsoft-azure-administrator-300x173.webp 300w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/az-104-microsoft-azure-administrator-768x442.webp 768w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/az-104-microsoft-azure-administrator-1536x883.webp 1536w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/az-104-microsoft-azure-administrator-2048x1178.webp 2048w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/az-104-microsoft-azure-administrator-150x86.webp 150w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">Once the Hands on lab page opens, scroll down further to select \u2018Automate deployment of resources by using templates\u2019. Click on the \u2018Create a Windows VM using an ARM Template Start button to begin the lab.<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-97468 size-large\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/windows-vm-arm-template-1024x584.webp\" alt=\"windows-vm-arm-template\" width=\"1024\" height=\"584\" \/><\/p>\n<p><span style=\"font-weight: 400;\">Once you click the Start button, you will be redirected to the lab page. Click on \u2018Start Guided Lab\u2019 to begin the lab.<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-97454 size-large\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/create-vm-windows-arm-template-1024x588.webp\" alt=\"create-vm-windows-arm-template\" width=\"1024\" height=\"588\" \/><\/p>\n<p><span style=\"font-weight: 400;\">To start the lab, we must\u00a0 enable the button by participating in Whizlabs Training. Agree to the Whizlabs Term of User and click \u2018Start lab\u2019.<\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-97467 size-large\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/windows-vm-arm-template-lab-confirmation-1024x588.webp\" alt=\"windows-vm-arm-template-lab-confirmation\" width=\"1024\" height=\"588\" \/><\/p>\n<p><span style=\"font-weight: 400;\">The lab will begin with Whizlabs User\u2019s Credentials, including Username and password. We provide lab steps along the screenshots to be followed in the Azure Portal. Click on the \u2018Open Console\u2019 Button which will redirect you to the Azure Portal.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><br \/>\n<\/span><img decoding=\"async\" class=\"aligncenter wp-image-97455 size-large\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/create-windows-vm-arm-template-lab-1024x588.webp\" alt=\"create-windows-vm-arm-template-lab\" width=\"1024\" height=\"588\" \/><\/p>\n<p><span style=\"font-weight: 400;\">Please give the Username and Password provided by Whizlabs on the Sign-in In Page.<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-97463 size-large\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/whizlabs-microsoft-azure-lab-login-username-1024x585.webp\" alt=\" whizlabs-microsoft-azure-lab-login-usernam\" width=\"1024\" height=\"585\" \/><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-97457 size-large\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/welcome-to-microsoft-azure-1024x587.webp\" alt=\" welcome-to-microsoft-azure\" width=\"1024\" height=\"587\" srcset=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/welcome-to-microsoft-azure-1024x587.webp 1024w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/welcome-to-microsoft-azure-300x172.webp 300w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/welcome-to-microsoft-azure-768x440.webp 768w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/welcome-to-microsoft-azure-1536x880.webp 1536w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/welcome-to-microsoft-azure-2048x1173.webp 2048w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/welcome-to-microsoft-azure-150x86.webp 150w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3><img decoding=\"async\" class=\"aligncenter wp-image-97480 size-large\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/Azure-services-1024x587.png\" alt=\"Azure-services\" width=\"1024\" height=\"587\" \/><\/h3>\n<h3><span style=\"font-weight: 400;\">Creation of an ARM Template\u00a0<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">To create a Windows Virtual Machine, you will need an ARM Template with A Windows Virtual Machine (VM). There follows an ARM Template, which uses a Windows Virtual Machine, public IPv4 address, virtual network, and subnet along with a network interface. A network security group (NSG) to enable Remote Desktop Protocol (RDP) connections.Diagnostics storage requirements. Template. The text file has to be saved as template.json.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">{<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\"$schema\": \"https:\/\/schema.management.azure.com\/schemas\/2019-04-01\/deploymentTemplate.json#\",<\/span>\r\n<span style=\"font-weight: 400;\">\"contentVersion\":\"1.0.0.0\",<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\"metadata\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"_generator\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"name\": \"bicep\",<\/span>\r\n<span style=\"font-weight: 400;\">\"version\": \"0.8.9.13224\",<\/span>\r\n<span style=\"font-weight: 400;\">\"templateHash\":\"15495738823141086515\"<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">\"parameters\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"adminUsername\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"type\": \"string\",<\/span>\r\n<span style=\"font-weight: 400;\">\"metadata\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"description\": \"Username for the Virtual Machine.\"<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">\"adminPassword\":{<\/span>\r\n<span style=\"font-weight: 400;\">\"type\":\"secureString\",<\/span>\r\n<span style=\"font-weight: 400;\">\"minLength\": 12,<\/span>\r\n<span style=\"font-weight: 400;\">\"metadata\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"description\":\"Password for the Virtual Machine.\"<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">\"dnsLabelPrefix\": {<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\"type\": \"string\",<\/span>\r\n<span style=\"font-weight: 400;\">\"defaultValue\": \"[toLower(format('{0}-{1}', parameters('vmName'), uniqueString(resourceGroup().id, parameters('vmName'))))]\",<\/span>\r\n<span style=\"font-weight: 400;\">\"metadata\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"description\": \"Unique DNS Name for the Public IP used to access the Virtual Machine.\"<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">\"publicIpName\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"type\": \"string\",<\/span>\r\n<span style=\"font-weight: 400;\">\"defaultValue\": \"myPublicIP\",<\/span>\r\n<span style=\"font-weight: 400;\">\"metadata\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"description\": \"Name for the Public IP used to access the Virtual Machine.\"<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">\"publicIPAllocationMethod\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"type\": \"string\",<\/span>\r\n<span style=\"font-weight: 400;\">\"defaultValue\": \"Dynamic\",<\/span>\r\n<span style=\"font-weight: 400;\">\"allowedValues\": [<\/span>\r\n<span style=\"font-weight: 400;\">\"Dynamic\",<\/span>\r\n<span style=\"font-weight: 400;\">\"Static\"<\/span>\r\n<span style=\"font-weight: 400;\">],<\/span>\r\n<span style=\"font-weight: 400;\">\"metadata\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"description\": \"Allocation method for the Public IP used to access the Virtual Machine.\"<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">\"publicIpSku\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"type\": \"string\",<\/span>\r\n<span style=\"font-weight: 400;\">\"defaultValue\": \"Basic\",<\/span>\r\n<span style=\"font-weight: 400;\">\"allowedValues\": [<\/span>\r\n<span style=\"font-weight: 400;\">\"Basic\",<\/span>\r\n<span style=\"font-weight: 400;\">\"Standard\"<\/span>\r\n<span style=\"font-weight: 400;\">],<\/span>\r\n<span style=\"font-weight: 400;\">\"metadata\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"description\": \"SKU for the Public IP used to access the Virtual Machine.\"<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">\"OSVersion\": {<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\"type\": \"string\",<\/span>\r\n<span style=\"font-weight: 400;\">\"defaultValue\": \"2022-datacenter-azure-edition-core\",<\/span>\r\n<span style=\"font-weight: 400;\">\"allowedValues\": [<\/span>\r\n<span style=\"font-weight: 400;\">\"2008-R2-SP1\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2008-R2-SP1-smalldisk\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2012-Datacenter\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2012-datacenter-gensecond\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2012-Datacenter-smalldisk\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2012-datacenter-smalldisk-g2\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2012-Datacenter-zhcn\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2012-datacenter-zhcn-g2\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2012-R2-Datacenter\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2012-r2-datacenter-gensecond\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2012-R2-Datacenter-smalldisk\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2012-r2-datacenter-smalldisk-g2\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2012-R2-Datacenter-zhcn\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2012-r2-datacenter-zhcn-g2\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2016-Datacenter\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2016-datacenter-gensecond\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2016-datacenter-gs\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2016-Datacenter-Server-Core\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2016-datacenter-server-core-g2\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2016-Datacenter-Server-Core-smalldisk\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2016-datacenter-server-core-smalldisk-g2\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2016-Datacenter-smalldisk\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2016-datacenter-smalldisk-g2\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2016-Datacenter-with-Containers\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2016-datacenter-with-containers-g2\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2016-datacenter-with-containers-gs\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2016-Datacenter-zhcn\",<\/span>\r\n<span style=\"font-weight: 400;\">=\"2016-datacenter-zhcn-g2\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2019-Datacenter\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2019-Datacenter-Core\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2019-datacenter-core-g2\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2019-Datacenter-Core-smalldisk\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2019-datacenter-core-smalldisk-g2\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2019-Datacenter-Core-with-Containers\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2019-datacenter-core-with-containers-g2\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2019-Datacenter-Core-with-Containers-smalldisk\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2019-datacenter-core-with-containers-smalldisk-g2\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2019-datacenter-gs\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2019-Datacenter-smalldisk\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2019-datacenter-smalldisk-g2\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2019-Datacenter-with-Containers\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2019-datacenter-with-containers-g2\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2019-datacenter-with-containers-gs\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2019-Datacenter-with-Containers-smalldisk\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2019-datacenter-with-containers-smalldisk-g2\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2019-Datacenter-zhcn\",<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\"2019-datacenter-zhcn-g2\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2022-datacenter\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2022-datacenter-azure-edition\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2022-datacenter-azure-edition-core\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2022-datacenter-azure-edition-core-smalldisk\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2022-datacenter-azure-edition-smalldisk\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2022-datacenter-core\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2022-datacenter-core-g2\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2022-datacenter-core-smalldisk\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2022-datacenter-core-smalldisk-g2\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2022-datacenter-g2\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2022-datacenter-smalldisk\",<\/span>\r\n<span style=\"font-weight: 400;\">\"2022-datacenter-smalldisk-g2\"<\/span>\r\n<span style=\"font-weight: 400;\">],<\/span>\r\n<span style=\"font-weight: 400;\">\"metadata\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"description\": \"The Windows version for the VM. This will pick a fully patched image of this given Windows version.\"<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">,<\/span>\r\n<span style=\"font-weight: 400;\">\"vmSize\":{<\/span>\r\n<span style=\"font-weight: 400;\">\"type\":\"string\",<\/span>\r\n<span style=\"font-weight: 400;\">\"defaultValue\": \"standard_b2s\",<\/span>\r\n<span style=\"font-weight: 400;\">\"metadata\":{<\/span>\r\n<span style=\"font-weight: 400;\">\"description\":\"Size of the virtual machine.\"<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">\"location\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"type\": \"string\",<\/span>\r\n<span style=\"font-weight: 400;\">\"defaultValue\": \"[resourceGroup().location]\",<\/span>\r\n<span style=\"font-weight: 400;\">\"metadata\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"description\": \"Location for all resources.\"<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">\"vmName\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"type\": \"string\",<\/span>\r\n<span style=\"font-weight: 400;\">\"defaultValue\": \"simple-vm\",<\/span>\r\n<span style=\"font-weight: 400;\">\"metadata\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"description\": \"Name of the virtual machine.\"<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">\"variables\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"storageAccountName\": \"[format('bootdiags{0}', uniqueString(resourceGroup().id))]\",<\/span>\r\n<span style=\"font-weight: 400;\">\"nicName\": \"myVMNic\",<\/span>\r\n<span style=\"font-weight: 400;\">\"addressPrefix\": \"10.0.0.0\/16\",<\/span>\r\n<span style=\"font-weight: 400;\">\"subnetName\": \"Subnet\",<\/span>\r\n<span style=\"font-weight: 400;\">\"subnetPrefix\": \"10.0.0.0\/24\",<\/span>\r\n<span style=\"font-weight: 400;\">\"virtualNetworkName\": \"MyVNET\",<\/span>\r\n<span style=\"font-weight: 400;\">\"networkSecurityGroupName\": \"default-NSG\"<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">\"resources\": [<\/span>\r\n<span style=\"font-weight: 400;\">{<\/span>\r\n<span style=\"font-weight: 400;\">\"type\": \"Microsoft.Storage\/storageAccounts\",<\/span>\r\n<span style=\"font-weight: 400;\">\"apiVersion\": \"2021-04-01\",<\/span>\r\n<span style=\"font-weight: 400;\">\"name\": \"[variables('storageAccountName')]\",<\/span>\r\n<span style=\"font-weight: 400;\">\"location\": \"[parameters('location')]\",<\/span>\r\n<span style=\"font-weight: 400;\">\"sku\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"name\": \"Standard_LRS\"<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">\"kind\": \"Storage\"<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">{<\/span>\r\n<span style=\"font-weight: 400;\">\"type\": \"Microsoft.Network\/publicIPAddresses\",<\/span>\r\n<span style=\"font-weight: 400;\">\"apiVersion\": \"2021-02-01\",<\/span>\r\n<span style=\"font-weight: 400;\">\"name\": \"[parameters('publicIpName')]\",&lt;\/span\r\n<span style=\"font-weight: 400;\">\u00a0\"location\": \"[parameters('location')]\",<\/span>\r\n<span style=\"font-weight: 400;\">\"sku\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"name\": \"[parameters('publicIpSku')]\"<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">\"properties\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"publicIPAllocationMethod\": \"[parameters('publicIPAllocationMethod')]\",<\/span>\r\n<span style=\"font-weight: 400;\">\"dnsSettings\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"domainNameLabel\": \"[parameters('dnsLabelPrefix')]\"<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">{<\/span>\r\n<span style=\"font-weight: 400;\">\"type\": \"Microsoft.Network\/networkSecurityGroups\",<\/span>\r\n<span style=\"font-weight: 400;\">\"apiVersion\": \"2021-02-01\",<\/span>\r\n<span style=\"font-weight: 400;\">\"name\": \"[variables('networkSecurityGroupName')]\",<\/span>\r\n<span style=\"font-weight: 400;\">\"location\": \"[parameters('location')]\",<\/span>\r\n<span style=\"font-weight: 400;\">\"properties\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"securityRules\": [<\/span>\r\n<span style=\"font-weight: 400;\">{<\/span>\r\n<span style=\"font-weight: 400;\">\"name\": \"default-allow-3389\",<\/span>\r\n<span style=\"font-weight: 400;\">\"properties\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"priority\": 1000,<\/span>\r\n<span style=\"font-weight: 400;\">\"access\": \"Allow\",<\/span>\r\n<span style=\"font-weight: 400;\">\"direction\": \"Inbound\",<\/span>\r\n<span style=\"font-weight: 400;\">\"destinationPortRange\": \"3389\",<\/span>\r\n<span style=\"font-weight: 400;\">\"protocol\": \"Tcp\",<\/span>\r\n<span style=\"font-weight: 400;\">\"sourcePortRange\": \"*\",<\/span>\r\n<span style=\"font-weight: 400;\">\"sourceAddressPrefix\": \"*\",<\/span>\r\n<span style=\"font-weight: 400;\">\"destinationAddressPrefix\": \"*\"<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">]<\/span>\r\n\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">{<\/span>\r\n<span style=\"font-weight: 400;\">\"type\": \"Microsoft.Network\/virtualNetworks\",<\/span>\r\n<span style=\"font-weight: 400;\">\"apiVersion\": \"2021-02-01\",<\/span>\r\n<span style=\"font-weight: 400;\">\"name\": \"[variables('virtualNetworkName')]\",<\/span>\r\n<span style=\"font-weight: 400;\">\"location\": \"[parameters('location')]\",<\/span>\r\n<span style=\"font-weight: 400;\">\"properties\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"addressSpace\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"addressPrefixes\": [<\/span>\r\n<span style=\"font-weight: 400;\">\"[variables('addressPrefix')]\"<\/span>\r\n<span style=\"font-weight: 400;\">]<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">\"subnets\": [<\/span>\r\n<span style=\"font-weight: 400;\">{<\/span>\r\n<span style=\"font-weight: 400;\">\"name\": \"[variables('subnetName')]\",<\/span>\r\n<span style=\"font-weight: 400;\">\"properties\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"addressPrefix\": \"[variables('subnetPrefix')]\",<\/span>\r\n<span style=\"font-weight: 400;\">\"networkSecurityGroup\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"id\": \"[resourceId('Microsoft.Network\/networkSecurityGroups', variables('networkSecurityGroupName'))]\"<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">]<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">\"dependsOn\": [<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\"[resourceId('Microsoft.Network\/networkSecurityGroups', variables('networkSecurityGroupName'))]\"<\/span>\r\n<span style=\"font-weight: 400;\">]<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">{<\/span>\r\n<span style=\"font-weight: 400;\">\"type\": \"Microsoft.Network\/networkInterfaces\",<\/span>\r\n<span style=\"font-weight: 400;\">\"apiVersion\": \"2021-02-01\",<\/span>\r\n<span style=\"font-weight: 400;\">\"name\": \"[variables('nicName')]\",<\/span>\r\n<span style=\"font-weight: 400;\">\"location\": \"[parameters('location')]\",<\/span>\r\n<span style=\"font-weight: 400;\">\"properties\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"ipConfigurations\": [<\/span>\r\n<span style=\"font-weight: 400;\">{<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\"name\": \"ipconfig1\",<\/span>\r\n<span style=\"font-weight: 400;\">\"properties\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"privateIPAllocationMethod\": \"Dynamic\",<\/span>\r\n<span style=\"font-weight: 400;\">\"publicIPAddress\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"id\": \"[resourceId('Microsoft.Network\/publicIPAddresses', parameters('publicIpName'))]\"<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">\"subnet\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"id\": \"[resourceId('Microsoft.Network\/virtualNetworks\/subnets', variables('virtualNetworkName'), variables('subnetName'))]\"<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">]<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">\"dependsOn\": [<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\"[resourceId('Microsoft.Network\/publicIPAddresses', parameters('publicIpName'))]\",<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\"[resourceId('Microsoft.Network\/virtualNetworks', variables('virtualNetworkName'))]\"<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0]<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">{<\/span>\r\n<span style=\"font-weight: 400;\">\"type\": \"Microsoft.Compute\/virtualMachines\",<\/span>\r\n<span style=\"font-weight: 400;\">\"apiVersion\": \"2021-03-01\",<\/span>\r\n<span style=\"font-weight: 400;\">\"name\": \"[parameters('vmName')]\",<\/span>\r\n<span style=\"font-weight: 400;\">\"location\": \"[parameters('location')]\",<\/span>\r\n<span style=\"font-weight: 400;\">\"properties\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"hardwareProfile\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"vmSize\": \"[parameters('vmSize')]\"<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">\"osProfile\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"computerName\": \"[parameters('vmName')]\",<\/span>\r\n<span style=\"font-weight: 400;\">\"adminUsername\": \"[parameters('adminUsername')]\",<\/span>\r\n<span style=\"font-weight: 400;\">\"adminPassword\": \"[parameters('adminPassword')]\"<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">\"storageProfile\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"imageReference\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"publisher\": \"MicrosoftWindowsServer\",<\/span>\r\n<span style=\"font-weight: 400;\">\"offer\": \"WindowsServer\",<\/span>\r\n<span style=\"font-weight: 400;\">\"sku\": \"[parameters('OSVersion')]\",<\/span>\r\n<span style=\"font-weight: 400;\">\"version\": \"latest\"<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0},<\/span>\r\n<span style=\"font-weight: 400;\">\"osDisk\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"createOption\": \"FromImage\",<\/span>\r\n<span style=\"font-weight: 400;\">\"managedDisk\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"storageAccountType\": \"StandardSSD_LRS\"<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">\"dataDisks\": [<\/span>\r\n<span style=\"font-weight: 400;\">{<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\"diskSizeGB\": 1023,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\"lun\": 0,<\/span>\r\n<span style=\"font-weight: 400;\">\"createOption\": \"Empty\"<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">]<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">\"networkProfile\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"networkInterfaces\": [<\/span>\r\n<span style=\"font-weight: 400;\">{<\/span>\r\n<span style=\"font-weight: 400;\">\"id\": \"[resourceId('Microsoft.Network\/networkInterfaces', variables('nicName'))]\"<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">]<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">\"diagnosticsProfile\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"bootDiagnostics\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"enabled\": true,<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\"storageUri\": \"[reference(resourceId('Microsoft.Storage\/storageAccounts', variables('storageAccountName'))).primaryEndpoints.blob]\"<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0}<\/span>\r\n<span style=\"font-weight: 400;\">},<\/span>\r\n<span style=\"font-weight: 400;\">\"dependsOn\": [<\/span>\r\n<span style=\"font-weight: 400;\">\"[resourceId('Microsoft.Network\/networkInterfaces', variables('nicName'))]\",<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\"[resourceId('Microsoft.Storage\/storageAccounts', variables('storageAccountName'))]\"<\/span>\r\n<span style=\"font-weight: 400;\">]<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0],<\/span>\r\n<span style=\"font-weight: 400;\">\"outputs\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"hostname\": {<\/span>\r\n<span style=\"font-weight: 400;\">\"type\": \"string\",<\/span>\r\n<span style=\"font-weight: 400;\">\"value\": \"[reference(resourceId('Microsoft.Network\/publicIPAddresses', parameters('publicIpName'))).dnsSettings.fqdn]\"<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0}<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span><\/span><\/pre>\n<p><strong>Deploy the ARM Template<\/strong><\/p>\n<p><span style=\"font-weight: 400;\">In the Azure Portal, open the Azure CLI within the Cloud Shell pane.<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-97482 size-large\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/Azure-login-page-1024x369.webp\" alt=\"Azure-login-page.\" width=\"1024\" height=\"369\" \/><\/p>\n<p><span style=\"font-weight: 400;\">In the pop-up box, Click on Bash.<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-97451 size-large\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/azure-cloud-shell-log-in-1024x580.webp\" alt=\"azure-cloud-shell-log-in\" width=\"1024\" height=\"580\" \/><\/p>\n<p><span style=\"font-weight: 400;\">In the getting started box, we have to enter the following details and click on apply.<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">Select \u201cNo storage account required\u201d.<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"><strong>Subscription<\/strong>: Select your own subscription<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><img decoding=\"async\" class=\"aligncenter wp-image-97452 size-large\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/azure-cloud-shell-subscription-1024x583.webp\" alt=\"azure-cloud-shell-subscription\" width=\"1024\" height=\"583\" \/><\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">In the toolbar of the Cloud Shell pane, select the <\/span><b>Manage file <\/b><span style=\"font-weight: 400;\">option and then click on <\/span><b>Upload <\/b><span style=\"font-weight: 400;\">to upload the <\/span><b>template.json<\/b><span style=\"font-weight: 400;\"> file into the Cloud Shell home directory.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"><img decoding=\"async\" class=\"aligncenter wp-image-97453 size-large\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/cloud-shell-home-directory-1024x577.webp\" alt=\"cloud-shell-home-directory\" width=\"1024\" height=\"577\" \/><\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">Now we will deploy the resources using the given command. This step may take a few minutes for the resources to be deployed successfully.<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">az deployment group create &#8211;name &lt;deployment-name&gt; &#8211;template-file &lt;path-to-template-file&gt; &#8211;parameters &#8216;{&#8220;adminUsername&#8221;: {&#8220;value&#8221;: &#8220;&lt;admin-username&gt;&#8221;}, &#8220;adminPassword&#8221;: {&#8220;value&#8221;: &#8220;&lt;admin-password&gt;&#8221;}}&#8217; &#8211;resource-group &lt;resource-group-name&gt;<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><b>NOTE: <\/b><span style=\"font-weight: 400;\">Copy this command to a text editor and replace:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">\u2018<\/span><b>&lt;deployment-name&gt;\u2019 <\/b><span style=\"font-weight: 400;\">with the name of your deployment<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>`&lt;resource-group-name&gt;`<\/b><span style=\"font-weight: 400;\"> with the name of your resource group<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>`&lt;path-to-template-file&gt;`<\/b><span style=\"font-weight: 400;\"> with the path to file containing the ARM template which in this case would be the file name<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>`&lt;admin-username&gt;`<\/b><span style=\"font-weight: 400;\"> with the username<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><b>`&lt;admin-password&gt;`<\/b><span style=\"font-weight: 400;\"> with a password of length <\/span><b>greater than or equal to 12<\/b><span style=\"font-weight: 400;\">.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\"><img decoding=\"async\" class=\"aligncenter wp-image-97462 size-large\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/deployment-verification-1024x263.webp\" alt=\"deployment-verification\" width=\"1024\" height=\"263\" \/><\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><strong>Verify the deployment<\/strong><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">After the execution of the above command, you will be deployed with Windows Virtual Machine.<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-97466 size-large\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/windows-virtual-machoine-deployed-1024x583.webp\" alt=\"windows-virtual-machoine-deployed\" width=\"1024\" height=\"583\" \/><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-97458 size-large\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/virtual-machine-deployed-final-result-1024x614.webp\" alt=\"virtual-machine-deployed-final-result\" width=\"1024\" height=\"614\" srcset=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/virtual-machine-deployed-final-result-1024x614.webp 1024w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/virtual-machine-deployed-final-result-300x180.webp 300w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/virtual-machine-deployed-final-result-768x461.webp 768w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/virtual-machine-deployed-final-result-1536x921.webp 1536w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/virtual-machine-deployed-final-result-2048x1228.webp 2048w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/virtual-machine-deployed-final-result-150x90.webp 150w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3><span style=\"font-weight: 400;\">ARM Deployment Modes<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Adopting resources in an ARM template requires an understanding of the available deployment modes in the <\/span><a href=\"https:\/\/learn.microsoft.com\/en-us\/azure\/azure-resource-manager\/management\/overview\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">Azure resource manager<\/span><\/a><span style=\"font-weight: 400;\">. ARM provides two deployment modes in which the user can choose to deploy the resources Incremental and complete.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">1. <strong>Incremental deployment mode<\/strong><\/span><\/p>\n<p><span style=\"font-weight: 400;\">In Incremental mode, Azure Resource Manager does any changes that are going to strengthen the resources included in the ARM template. If a resource exists, then it will be modified; if such resources do not exist, they will be constructed. However, the existing resources within the resource group which are not included in the template are not modified.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">2. <strong>Complete deployment mode<\/strong><\/span><\/p>\n<p><span style=\"font-weight: 400;\">In Complete mode, any resources that have not been included in the ARM template will be deleted. It does not matter the number of resources, or which particular resources are deployed within the resource group, they would all be wiped out and only those resources which are expounded in the template would remain.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Conclusion:<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">In this blog, we have discussed some of the important aspects of why one should consider the usage of ARM templates, beginning from the need for repeatability and idempotency to the ease of resource handling provided by centralized configurations.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">As you have followed the steps \u2013 connecting via Azure CLI, you have practically learned how to make use of the ARM templates through Azure CLI. You can explore these steps in <\/span><a href=\"https:\/\/www.whizlabs.com\/azure-sandbox\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">Whizlabs Sandbox<\/span><\/a><span style=\"font-weight: 400;\"> or explore our <\/span><a href=\"https:\/\/www.whizlabs.com\/learn\/course\/microsoft-azure-certification-az-104\/298\/lab\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">Hands-on Labs<\/span><\/a><span style=\"font-weight: 400;\"> for experimentation. Whether you prefer self-paced exploration or structured guidance, <\/span><b>Whizlabs<\/b><span style=\"font-weight: 400;\"> has the tools to support your learning journey.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this blog post, we will look into Optimizing Azure Deployments Using ARM Templates and understand how to deploy an ARM template using Azure CLI. We will explore a live scenario to give you hands-on experience in deploying resources in Azure, helping you grasp the practical aspects of optimizing and automating your deployments efficiently. ARM templates are design documents created in JSON file format and are used in the Azure Resource Manager to outline how the resources in Azure will be structured and used. Therefore, these templates allow resources to be deployed and maintained in a repeatable manner with assurance [&hellip;]<\/p>\n","protected":false},"author":436,"featured_media":97448,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"default","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[15],"tags":[5223],"class_list":["post-97444","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microsoft-azure","tag-azure-arm-templates"],"uagb_featured_image_src":{"full":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/optimizing-azure-deployments-arm-templates-scaled.webp",2560,1280,false],"thumbnail":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/optimizing-azure-deployments-arm-templates-150x150.webp",150,150,true],"medium":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/optimizing-azure-deployments-arm-templates-300x150.webp",300,150,true],"medium_large":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/optimizing-azure-deployments-arm-templates-768x384.webp",768,384,true],"large":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/optimizing-azure-deployments-arm-templates-1024x512.webp",1024,512,true],"1536x1536":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/optimizing-azure-deployments-arm-templates-1536x768.webp",1536,768,true],"2048x2048":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/optimizing-azure-deployments-arm-templates-2048x1024.webp",2048,1024,true],"profile_24":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/optimizing-azure-deployments-arm-templates-24x24.webp",24,24,true],"profile_48":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/optimizing-azure-deployments-arm-templates-48x48.webp",48,48,true],"profile_96":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/optimizing-azure-deployments-arm-templates-96x96.webp",96,96,true],"profile_150":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/optimizing-azure-deployments-arm-templates-150x150.webp",150,150,true],"profile_300":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/optimizing-azure-deployments-arm-templates-300x300.webp",300,300,true],"tptn_thumbnail":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/optimizing-azure-deployments-arm-templates-250x250.webp",250,250,true],"web-stories-poster-portrait":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/optimizing-azure-deployments-arm-templates-640x853.webp",640,853,true],"web-stories-publisher-logo":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/optimizing-azure-deployments-arm-templates-96x96.webp",96,96,true],"web-stories-thumbnail":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2024\/09\/optimizing-azure-deployments-arm-templates-150x75.webp",150,75,true]},"uagb_author_info":{"display_name":"Swetha Selvakumar","author_link":"https:\/\/www.whizlabs.com\/blog\/author\/swetha-selvakumar\/"},"uagb_comment_info":3,"uagb_excerpt":"In this blog post, we will look into Optimizing Azure Deployments Using ARM Templates and understand how to deploy an ARM template using Azure CLI. We will explore a live scenario to give you hands-on experience in deploying resources in Azure, helping you grasp the practical aspects of optimizing and automating your deployments efficiently. ARM&hellip;","_links":{"self":[{"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/posts\/97444","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/users\/436"}],"replies":[{"embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/comments?post=97444"}],"version-history":[{"count":24,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/posts\/97444\/revisions"}],"predecessor-version":[{"id":97847,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/posts\/97444\/revisions\/97847"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/media\/97448"}],"wp:attachment":[{"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/media?parent=97444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/categories?post=97444"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/tags?post=97444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}