5 Writing advanced ARM templates

 

This chapter covers

  • Writing an ARM template that deploys to more than one scope
  • Structuring large IaC solutions into more than one template
  • Dealing with dependencies and ordering resources in a deployment
  • Advanced constructs like conditions, loops, and deployment scripts
  • Reverse engineering existing infrastructure into an ARM template

In chapter 3 we explored the different sections of an ARM template and learned how to use all of them. In that chapter, we also worked on the infrastructure for an API that serves as the backend for a web shop that was responsible for processing the orders that come in, among other things. There was an App Service for hosting the API itself, and other components like a Key Vault, Application Insights, SQL Server and database, and storage accounts. This chapter will continue with those components and use them to go into more advanced ARM topics.

5.1 Deploying to multiple scopes using nested templates

5.1.1 Nested templates on a management group

5.1.2 Evaluation scope

5.1.3 Outputs

5.2 How to structure solutions

5.2.1 Small to medium solutions

5.2.2 Large solutions

5.3 Modularizing templates with linked templates

5.3.1 Using a URI

5.3.2 Using a relative path

5.4 Deploying resources in order

5.4.1 Explicit deployment ordering

5.4.2 Implicit deployment ordering

5.5 Conditionally deploying resources

5.5.1 Applying conditions to output

5.6 Using loops to create multiple resources