{"id":14443,"date":"2020-07-31T04:40:50","date_gmt":"2020-07-31T04:40:50","guid":{"rendered":"https:\/\/www.testpreptraining.com\/tutorial\/?page_id=14443"},"modified":"2022-04-06T04:52:39","modified_gmt":"2022-04-06T04:52:39","slug":"updating-a-resource-in-an-azure-resource-manager-template","status":"publish","type":"page","link":"https:\/\/www.testpreptraining.ai\/tutorial\/updating-a-resource-in-an-azure-resource-manager-template\/","title":{"rendered":"Updating a resource in an Azure Resource Manager template"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><strong>Exam AZ-303 is retired.\u00a0<a href=\"https:\/\/www.testpreptraining.ai\/designing-microsoft-azure-infrastructure-solutions-az-305\" target=\"_blank\" rel=\"noreferrer noopener\">AZ-305<\/a>\u00a0replacement is available.<\/strong><\/h2>\n\n\n\n<p>This tutorial will explain you the process involved in Updating a resource in an Azure Resource Manager template. There are some scenarios in which you need to update a resource during a deployment. You might encounter this scenario when you cannot specify all the properties for a resource until other, dependent resources are created. For example, if you create a backend pool for a load balancer, you might update the network interfaces (NICs) on your virtual machines (VMs) to include them in the backend pool. And while Resource Manager supports updating resources during deployment, you must design your template correctly to avoid errors and to ensure the deployment is handled as an update.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"example-template\"><strong>Example template<\/strong><\/h3>\n\n\n\n<p>Let&#8217;s look at an example template that demonstrates this. This deploys a virtual network named&nbsp;<code>firstVNet<\/code>&nbsp;that has one subnet named&nbsp;<code>firstSubnet<\/code>. It then deploys a virtual network interface (NIC) named&nbsp;<code>nic1<\/code>&nbsp;and associates it with our subnet. Then, a deployment resource named&nbsp;<code>updateVNet<\/code>&nbsp;includes a nested template that updates our&nbsp;<code>firstVNet<\/code>&nbsp;resource by adding a second subnet named&nbsp;<code>secondSubnet<\/code>.<\/p>\n\n\n\n<p>Let&#8217;s take a look at the resource object for our&nbsp;<code>firstVNet<\/code>&nbsp;resource first. Notice that we specify again the settings for our&nbsp;<code>firstVNet<\/code>&nbsp;in a nested template\u2014this is because Resource Manager doesn&#8217;t allow the same deployment name within the same template and nested templates are considered to be a different tone. By again specifying our values for our&nbsp;<code>firstSubnet<\/code>&nbsp;resource, we are telling Resource Manager to update the existing resource instead of deleting it and redeploying it. Finally, our new settings for&nbsp;<code>secondSubnet<\/code>&nbsp;are picked up during this update.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"try-the-template\"><strong>Trying the template<\/strong><\/h3>\n\n\n\n<p>An example is available on&nbsp;GitHub. To deploy the template, run the following&nbsp;Azure CLI&nbsp;commands:<\/p>\n\n\n\n<p>az group create &#8211;location &#8211;name<br>az group deployment create -g \\<br>&#8211;template-uri https:\/\/raw.githubusercontent.com\/mspnp\/template-examples\/master\/example1-update\/deploy.json<\/p>\n\n\n\n<p>Once deployment has finished, open the resource group you specified in the portal. You see a virtual network named&nbsp;<code>firstVNet<\/code>&nbsp;and a NIC named&nbsp;<code>nic1<\/code>. Click&nbsp;<code>firstVNet<\/code>, then click&nbsp;<code>subnets<\/code>. You see the&nbsp;<code>firstSubnet<\/code>&nbsp;that was originally created, and you see the&nbsp;<code>secondSubnet<\/code>&nbsp;that was added in the&nbsp;<code>updateVNet<\/code>&nbsp;resource.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/docs.microsoft.com\/en-us\/azure\/architecture\/building-blocks\/_images\/firstvnet-subnets.png\" alt=\"Original subnet and updated subnet\"\/><figcaption>Image Source &#8211; Microsoft<\/figcaption><\/figure><\/div>\n\n\n\n<p>Then, go back to the resource group and click&nbsp;<code>nic1<\/code>&nbsp;then click&nbsp;<code>IP configurations<\/code>. In the&nbsp;<code>IP configurations<\/code>&nbsp;section, the&nbsp;<code>subnet<\/code>&nbsp;is set to&nbsp;<code>firstSubnet (10.0.0.0\/24)<\/code>.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/docs.microsoft.com\/en-us\/azure\/architecture\/building-blocks\/_images\/nic1-ipconfigurations.png\" alt=\"Updating a resource in an Azure Resource Manager template\"\/><figcaption>Image Source &#8211; Microsoft<\/figcaption><\/figure><\/div>\n\n\n\n<p>The original&nbsp;<code>firstVNet<\/code>&nbsp;has been updated instead of re-created. If&nbsp;<code>firstVNet<\/code>&nbsp;had been re-created,&nbsp;<code>nic1<\/code>&nbsp;would not be associated with&nbsp;<code>firstVNet<\/code>.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"https:\/\/www.testpreptraining.ai\/microsoft-azure-architect-technologies-az-303-free-practice-test\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" width=\"960\" height=\"150\" src=\"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/07\/Untitled-design-5.png\" alt=\"free practice test for AZ- 303\" class=\"wp-image-13928\" srcset=\"https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/07\/Untitled-design-5.png 960w, https:\/\/www.testpreptraining.ai\/tutorial\/wp-content\/uploads\/2020\/07\/Untitled-design-5-750x117.png 750w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><\/a><\/figure><\/div>\n\n\n\n<p><a href=\"https:\/\/www.testpreptraining.ai\/tutorial\/exam-az-303-microsoft-azure-architect-technologies\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Go back to home page <\/strong><\/a><\/p>\n\n\n\n<p class=\"has-text-align-right\"><strong>Reference documentation &#8211; <a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/architecture\/building-blocks\/extending-templates\/update-resource\" target=\"_blank\" rel=\"noreferrer noopener\">Update a resource in an Azure Resource Manager template<\/a> <\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Exam AZ-303 is retired.\u00a0AZ-305\u00a0replacement is available. This tutorial will explain you the process involved in Updating a resource in an Azure Resource Manager template. There are some scenarios in which you need to update a resource during a deployment. You might encounter this scenario when you cannot specify all the properties for a resource until&#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-14443","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>Updating a resource in an Azure Resource Manager template<\/title>\n<meta name=\"description\" content=\"Enhance and upgrade your Azure Architect skills by preparing from tutorial - Updating a resource in an Azure Resource Manager template.\" \/>\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\/updating-a-resource-in-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=\"Updating a resource in an Azure Resource Manager template\" \/>\n<meta property=\"og:description\" content=\"Enhance and upgrade your Azure Architect skills by preparing from tutorial - Updating a resource in an Azure Resource Manager template.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.testpreptraining.ai\/tutorial\/updating-a-resource-in-an-azure-resource-manager-template\/\" \/>\n<meta property=\"og:site_name\" content=\"Testprep Training Tutorials\" \/>\n<meta property=\"article:modified_time\" content=\"2022-04-06T04:52:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/docs.microsoft.com\/en-us\/azure\/architecture\/building-blocks\/_images\/firstvnet-subnets.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\/updating-a-resource-in-an-azure-resource-manager-template\/\",\"url\":\"https:\/\/www.testpreptraining.ai\/tutorial\/updating-a-resource-in-an-azure-resource-manager-template\/\",\"name\":\"Updating a resource in an Azure Resource Manager template\",\"isPartOf\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/#website\"},\"datePublished\":\"2020-07-31T04:40:50+00:00\",\"dateModified\":\"2022-04-06T04:52:39+00:00\",\"description\":\"Enhance and upgrade your Azure Architect skills by preparing from tutorial - Updating a resource in an Azure Resource Manager template.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/updating-a-resource-in-an-azure-resource-manager-template\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.testpreptraining.ai\/tutorial\/updating-a-resource-in-an-azure-resource-manager-template\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.testpreptraining.ai\/tutorial\/updating-a-resource-in-an-azure-resource-manager-template\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.testpreptraining.ai\/tutorial\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Updating a resource in 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":"Updating a resource in an Azure Resource Manager template","description":"Enhance and upgrade your Azure Architect skills by preparing from tutorial - Updating a resource in an Azure Resource Manager template.","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\/updating-a-resource-in-an-azure-resource-manager-template\/","og_locale":"en_US","og_type":"article","og_title":"Updating a resource in an Azure Resource Manager template","og_description":"Enhance and upgrade your Azure Architect skills by preparing from tutorial - Updating a resource in an Azure Resource Manager template.","og_url":"https:\/\/www.testpreptraining.ai\/tutorial\/updating-a-resource-in-an-azure-resource-manager-template\/","og_site_name":"Testprep Training Tutorials","article_modified_time":"2022-04-06T04:52:39+00:00","og_image":[{"url":"https:\/\/docs.microsoft.com\/en-us\/azure\/architecture\/building-blocks\/_images\/firstvnet-subnets.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\/updating-a-resource-in-an-azure-resource-manager-template\/","url":"https:\/\/www.testpreptraining.ai\/tutorial\/updating-a-resource-in-an-azure-resource-manager-template\/","name":"Updating a resource in an Azure Resource Manager template","isPartOf":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/#website"},"datePublished":"2020-07-31T04:40:50+00:00","dateModified":"2022-04-06T04:52:39+00:00","description":"Enhance and upgrade your Azure Architect skills by preparing from tutorial - Updating a resource in an Azure Resource Manager template.","breadcrumb":{"@id":"https:\/\/www.testpreptraining.ai\/tutorial\/updating-a-resource-in-an-azure-resource-manager-template\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.testpreptraining.ai\/tutorial\/updating-a-resource-in-an-azure-resource-manager-template\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.testpreptraining.ai\/tutorial\/updating-a-resource-in-an-azure-resource-manager-template\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.testpreptraining.ai\/tutorial\/"},{"@type":"ListItem","position":2,"name":"Updating a resource in 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\/14443","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=14443"}],"version-history":[{"count":3,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages\/14443\/revisions"}],"predecessor-version":[{"id":54179,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/pages\/14443\/revisions\/54179"}],"wp:attachment":[{"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/media?parent=14443"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/categories?post=14443"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.testpreptraining.ai\/tutorial\/wp-json\/wp\/v2\/tags?post=14443"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}