{"id":17554,"date":"2020-08-24T08:30:59","date_gmt":"2020-08-24T08:30:59","guid":{"rendered":"https:\/\/www.testpreptraining.com\/tutorial\/?page_id=17554"},"modified":"2020-08-28T05:07:57","modified_gmt":"2020-08-28T05:07:57","slug":"update-an-azure-resource-manager-template","status":"publish","type":"page","link":"https:\/\/www.testpreptraining.ai\/tutorial\/update-an-azure-resource-manager-template\/","title":{"rendered":"Update an Azure Resource Manager template"},"content":{"rendered":"\n<p class=\"has-text-align-right\"><strong><a href=\"https:\/\/www.testpreptraining.ai\/tutorial\/exam-az-104-microsoft-azure-administrator-associate\/\" target=\"_blank\" rel=\"noreferrer noopener\">Return to AZ-104 Tutorial<\/a><\/strong><\/p>\n\n\n\n<p>Here you will learn and understand how to update resources in an Azure resource manager template. On this page, you\u2019ll understand the step by step process regarding the same. So, let\u2019s begin.<\/p>\n\n\n\n<p>There are various situations in which you require to update a resource during a deployment. So, there is a chance you may encounter this scenario when you are unable to define all the properties for a resource.&nbsp;<\/p>\n\n\n\n<p>For instance, if you create a backend pool for a load balancer, you might update the network interfaces on your VM to incorporate them in the backend pool. Certainly, Resource Manager maintains resources during deployment, still, you must design your template accurately to avoid errors. Furthermore, to ensure the deployment is operated as an update.<\/p>\n\n\n\n<p>Therefore, first, you must reference the resource to create it. Later, then reference the resource by the same name to update it. And, in, case, two resources have the same name, Resource Manager delivers an exception. In order to avoid the error, define the updated resource in a second template that&#8217;s linked as a subtemplate utilising the Microsoft.Resources\/deployments resource type.<\/p>\n\n\n\n<p>Secondly, you must specify the name of the existing property to edit or a new name for a property to unite in the nested template. Also, you must designate the original properties and their original values. And, then if you fail to provide the original properties and values, Resource Manager thinks you wish to create a new resource and eliminates the original resource.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>Example template<\/strong><\/h5>\n\n\n\n<p>To give it a clear view, let&#8217;s first take a look at the resource object for our firstVNet resource. Notice that the settings must be defined again for our firstVNet in a nested template. Well, the reason being, Resource Manager doesn&#8217;t provide the same deployment name under the same template. And, nested templates are studied to be a different template. Further, specifying the values again for the firstSubnet resource. Then the Resource Manager must be updated in the existing resource rather deleting it and redeploying it. Lastly, the new settings for secondSubnet are picked up throughout this update.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">{\n\"$schema\": \"https:\/\/schema.management.azure.com\/schemas\/2015-01-01\/deploymentTemplate.json#\",\n\"contentVersion\": \"1.0.0.0\",\n\"parameters\": {},\n\"resources\": [\n{\n\"apiVersion\": \"2016-03-30\",\n\"name\": \"firstVNet\",\n\"location\":\"[resourceGroup().location]\",\n\"type\": \"Microsoft.Network\/virtualNetworks\",\n\"properties\": {\n\"addressSpace\":{\"addressPrefixes\": [\n\"10.0.0.0\/22\"\n]},\n\"subnets\":[\n{\n\"name\":\"firstSubnet\",\n\"properties\":{\n\"addressPrefix\":\"10.0.0.0\/24\"\n}\n}\n]\n}\n},\n{\n\"apiVersion\": \"2015-06-15\",\n\"type\":\"Microsoft.Network\/networkInterfaces\",\n\"name\":\"nic1\",\n\"location\":\"[resourceGroup().location]\",\n\"dependsOn\": [\n\"firstVNet\"\n],\n\"properties\": {\n\"ipConfigurations\":[\n{\n\"name\":\"ipconfig1\",\n\"properties\": {\n\"privateIPAllocationMethod\":\"Dynamic\",\n\"subnet\": {\n\"id\": \"[concat(resourceId('Microsoft.Network\/virtualNetworks','firstVNet'),'\/subnets\/firstSubnet')]\"\n}\n}\n}\n]\n}\n},\n{\n\"apiVersion\": \"2015-01-01\",\n\"type\": \"Microsoft.Resources\/deployments\",\n\"name\": \"updateVNet\",\n\"dependsOn\": [\n\"nic1\"\n],\n\"properties\": {\n\"mode\": \"Incremental\",\n\"parameters\": {},\n\"template\": {\n\"$schema\": \"https:\/\/schema.management.azure.com\/schemas\/2015-01-01\/deploymentTemplate.json#\",\n\"contentVersion\": \"1.0.0.0\",\n\"parameters\": {},\n\"variables\": {},\n\"resources\": [\n{\n\"apiVersion\": \"2016-03-30\",\n\"name\": \"firstVNet\",\n\"location\":\"[resourceGroup().location]\",\n\"type\": \"Microsoft.Network\/virtualNetworks\",\n\"properties\": {\n\"addressSpace\": \"[reference('firstVNet').addressSpace]\",\n\"subnets\":[\n{\n\"name\":\"[reference('firstVNet').subnets[0].name]\",\n\"properties\":{\n\"addressPrefix\":\"[reference('firstVNet').subnets[0].properties.addressPrefix]\"\n}\n},\n{\n\"name\":\"secondSubnet\",\n\"properties\":{\n\"addressPrefix\":\"10.0.1.0\/24\"\n}\n}\n]\n}\n}\n],\n\"outputs\": {}\n}\n}\n}\n],\n\"outputs\": {}\n}\n<\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/www.testpreptraining.ai\/microsoft-azure-administrator-associate-az-104-free-practice-test\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/06\/practice-test-2.png\" alt=\"Practice Test for AZ-104\"\/><\/a><\/figure><\/div>\n\n\n\n<h5 class=\"wp-block-heading\"><strong>Try the template<\/strong><\/h5>\n\n\n\n<p>To deploy the template, run the subsequent Azure CLI commands:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">az group create --location --name<br>az deployment group create -g \\<br>--template-uri https:\/\/raw.githubusercontent.com\/mspnp\/template-examples\/master\/example1-update\/deploy.json<\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>Once deployment finishes, open the resource group you specified in the portal.&nbsp;<\/li><li>Now, you\u2019ll be able to see a virtual network named firstVNet and a NIC named nic1.&nbsp;<\/li><li>After this, click firstVNet, then click subnets. You see the firstSubnet that was originally created, and you see the secondSubnet that was added in the updateVNet resource.<\/li><li>Now, go back to the resource group and click nic1 then click IP configurations. In the IP configurations section, the subnet is set to firstSubnet (10.0.0.0\/24).<\/li><li>The original firstVNet has been updated rather being of re-created. If firstVNet had been re-created, nic1 would not be associated with firstVNet.<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"https:\/\/www.testpreptraining.ai\/microsoft-azure-administrator-associate-az-104-online-course\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/07\/testpreptraining.ai-2-750x117.png\" alt=\"This image has an empty alt attribute; its file name is testpreptraining.ai-2-750x117.png\"\/><\/a><\/figure><\/div>\n\n\n\n<p class=\"has-text-align-right\"><strong>Reference: <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/architecture\/building-blocks\/extending-templates\/update-resource\" target=\"_blank\" rel=\"noreferrer noopener\">Microsoft Documentation<\/a><\/strong><\/p>\n\n\n\n<p><strong><a href=\"https:\/\/www.testpreptraining.ai\/tutorial\/exam-az-104-microsoft-azure-administrator-associate\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong><a href=\"https:\/\/www.testpreptraining.ai\/tutorial\/exam-az-104-microsoft-azure-administrator-associate\/\" target=\"_blank\" rel=\"noreferrer noopener\">Return to AZ-104 Tutorial<\/a><\/strong><\/a><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Return to AZ-104 Tutorial Here you will learn and understand how to update resources in an Azure resource manager template. On this page, you\u2019ll understand the step by step process regarding the same. So, let\u2019s begin. There are various situations in which you require to update a resource during a deployment. So, there is a&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"categories":[],"tags":[],"class_list":["post-17554","page","type-page","status-publish","hentry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Update an Azure Resource Manager template - Testprep Training Tutorials<\/title>\n<meta name=\"description\" content=\"Increase your skills by learning about Azure Resource with Azure compute resources using Microsoft Azure AZ-104 online course Now!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.testpreptraining.ai\/tutorial\/update-an-azure-resource-manager-template\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Update an Azure Resource Manager template - Testprep Training Tutorials\" \/>\n<meta property=\"og:description\" content=\"Increase your skills by learning about Azure Resource with Azure compute resources using Microsoft Azure AZ-104 online course Now!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.testpreptraining.ai\/tutorial\/update-an-azure-resource-manager-template\/\" \/>\n<meta property=\"og:site_name\" content=\"Testprep Training Tutorials\" \/>\n<meta property=\"article:modified_time\" content=\"2020-08-28T05:07:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/06\/practice-test-2.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/update-an-azure-resource-manager-template\/\",\"url\":\"https:\/\/www.testpreptraining.ai\/tutorial\/update-an-azure-resource-manager-template\/\",\"name\":\"Update an Azure Resource Manager template - Testprep Training Tutorials\",\"isPartOf\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#website\"},\"datePublished\":\"2020-08-24T08:30:59+00:00\",\"dateModified\":\"2020-08-28T05:07:57+00:00\",\"description\":\"Increase your skills by learning about Azure Resource with Azure compute resources using Microsoft Azure AZ-104 online course Now!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/update-an-azure-resource-manager-template\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.testpreptraining.ai\/tutorial\/update-an-azure-resource-manager-template\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/update-an-azure-resource-manager-template\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.testpreptraining.ai\/tutorial\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Update an Azure Resource Manager template\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#website\",\"url\":\"https:\/\/www.testpreptraining.ai\/tutorial\/\",\"name\":\"Testprep Training Tutorials\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.testpreptraining.ai\/tutorial\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#organization\",\"name\":\"Testprep Training\",\"url\":\"https:\/\/www.testpreptraining.ai\/tutorial\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.testpreptraining.com\/tutorial\/wp-content\/uploads\/2020\/07\/tpt-logo-6.png\",\"contentUrl\":\"https:\/\/www.testpreptraining.com\/tutorial\/wp-content\/uploads\/2020\/07\/tpt-logo-6.png\",\"width\":583,\"height\":153,\"caption\":\"Testprep Training\"},\"image\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Update an Azure Resource Manager template - Testprep Training Tutorials","description":"Increase your skills by learning about Azure Resource with Azure compute resources using Microsoft Azure AZ-104 online course Now!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.testpreptraining.ai\/tutorial\/update-an-azure-resource-manager-template\/","og_locale":"en_US","og_type":"article","og_title":"Update an Azure Resource Manager template - Testprep Training Tutorials","og_description":"Increase your skills by learning about Azure Resource with Azure compute resources using Microsoft Azure AZ-104 online course Now!","og_url":"https:\/\/www.testpreptraining.ai\/tutorial\/update-an-azure-resource-manager-template\/","og_site_name":"Testprep Training Tutorials","article_modified_time":"2020-08-28T05:07:57+00:00","og_image":[{"url":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/06\/practice-test-2.png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/update-an-azure-resource-manager-template\/","url":"https:\/\/www.testpreptraining.ai\/tutorial\/update-an-azure-resource-manager-template\/","name":"Update an Azure Resource Manager template - Testprep Training Tutorials","isPartOf":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#website"},"datePublished":"2020-08-24T08:30:59+00:00","dateModified":"2020-08-28T05:07:57+00:00","description":"Increase your skills by learning about Azure Resource with Azure compute resources using Microsoft Azure AZ-104 online course Now!","breadcrumb":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/update-an-azure-resource-manager-template\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.testpreptraining.ai\/tutorial\/update-an-azure-resource-manager-template\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/update-an-azure-resource-manager-template\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.testpreptraining.ai\/tutorial\/"},{"@type":"ListItem","position":2,"name":"Update an Azure Resource Manager template"}]},{"@type":"WebSite","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#website","url":"https:\/\/www.testpreptraining.ai\/tutorial\/","name":"Testprep Training Tutorials","description":"","publisher":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.testpreptraining.ai\/tutorial\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#organization","name":"Testprep Training","url":"https:\/\/www.testpreptraining.ai\/tutorial\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#\/schema\/logo\/image\/","url":"https:\/\/www.testpreptraining.com\/tutorial\/wp-content\/uploads\/2020\/07\/tpt-logo-6.png","contentUrl":"https:\/\/www.testpreptraining.com\/tutorial\/wp-content\/uploads\/2020\/07\/tpt-logo-6.png","width":583,"height":153,"caption":"Testprep Training"},"image":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages\/17554","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/comments?post=17554"}],"version-history":[{"count":3,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages\/17554\/revisions"}],"predecessor-version":[{"id":18402,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages\/17554\/revisions\/18402"}],"wp:attachment":[{"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/media?parent=17554"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/categories?post=17554"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/tags?post=17554"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}