3 Writing ARM templates

 

This chapter covers

  • The structure of an ARM template
  • Declaring resources and child resources
  • Working with parameters and variables
  • Returning outputs
  • Using and writing functions

In chapter 2 you were introduced to a simple ARM template, and you saw how to deploy it. This chapter goes into much more depth on ARM templates, exploring various techniques and features. While chapter 2 showed how to create your first template and briefly introduced an ARM template layout, this chapter covers declaring resources, parameters, variables, functions, and output sections in depth.

To help illustrate these topics, you’ll create an ARM template over the course of the chapter. This infrastructure hosts an API, which is the backend for a web shop. It can accept, process, and store orders. The API saves all orders in a SQL database and generates a PDF file, which is sent to the customer via email. These PDF files are also stored in an Azure storage account for later use. The API itself runs on an Azure App Service and uses Key Vault as a secret store. Finally, we’ll throw Application Insights into the mix, which allows for monitoring the API. Figure 3.1 provides a visualization of this infrastructure.

Figure 3.1 A simple application architecture

3.1 Resources

3.1.1 Child resources

3.2 Parameters

3.2.1 Parameter types

3.2.2 Limiting and describing parameter values

3.2.3 Specifying parameter values

3.3 Variables

3.4 Outputs

3.5 Functions

3.5.1 Expressions

3.5.2 Built-in functions

3.5.3 User-defined functions

Summary