Skip to content

kunalbabre/nested-arm-template-101

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alternative approach to working with nested ARM templates

Using Azure Resource Manager templates (JSON format) is an easy and reliable way to deploy resources on Azure. It allows for codifying the infrastructure and version controlling every change to it a.k.a. Infrastructure-as-Code (IaC).

A single template can deploy hundreds of resources, however there are limits on the physical size and parameters (see Template limits section). From a maintainability perspective, it may not always be a good idea to build one gigantic template. There is a lot of good material written on the single vs nested templates.

Now that we have decided to build a nested template and probably quickly scrambled an example together, we might next stumble upon how to run this sample, since references to nested templates are required to be accessible publicly.

A very commonly used way is to host it on the public Git repository and hard reference the URIs, however templates are also hosted on an Azure storage account as an alternative approach described here.

Discussed below is another alternative, which comes handy when experimenting, learning and testing changes quickly without having to push code either on Git or on a storage account.

Preparation (one off)

Running the Scripts (once for each session)

  1. Download a sample copy of the nested scripts from https://github.com/kunalbabre/nested-arm-template-101 into c:\nested-arm-template-101
  2. Open c:\nested-arm-template-101 folder in command prompt
  3. Type http-server and hit enter
  4. Next note the port number it is running on - you will get something like http://127.0.0.1:`8080` where 8080 is the port where our site is getting served locally
  5. Now open a second command prompt window
  6. Type cd c:\ngrokand hit enter
  7. Type Ngork.exe http 8080 and hit enter to serve the files externally
  8. Next note the unique subdomain name - you will get something like https://c1a178dc.ngrok.io, copy c1a178dc
  9. Open the PowerShell script c:\nested-arm-template-101\sampleDeploy.ps1 in PowerShell ISE
  10. Replace <ngrok-subDomainName> with one you noted in step 8 above

(As required)

  1. Run (hit F5)
  2. Provide your Azure account details (Login-AzureRmAccount command on PowerShell required only once)
  3. Once the script has been successfully deployed you will be able to see the App Service Plan and the Website created under Azure portal
  4. Browser to the website http://c1a178dc-test-site-name.azurewebsites.net/

Releases

No releases published

Packages

No packages published