chapter ten

10 Template Specs and Bicep Registry: Building a repository of templates

 

This chapter covers

  • Storing ARM and Bicep templates as a reusable Azure resource
  • Deploying Template Specs using the CLI, PowerShell or the portal
  • Referencing Template Specs from another template
  • Alternatives to using Template Specs

Imagine working at a large company with many teams, and all of them are running applications on Azure infrastructure. Most of these applications run on similar infrastructures, like virtual machines, Kubernetes, or App Service Plans. No one wants to write the same ARM or Bicep templates over and over to create those infrastructures, right? And besides the repetitive work, most companies have some standard approach to these infrastructures that they want to impose on every team.

In this chapter, you learn how to store ARM or Bicep templates in Azure and make them available for others to re-use your templates.

10.1 Use case: a repository of compliant resources

Let’s say you work at Doush Bank, a bank serving millions of customers all over Europe. A bank like this has hundreds of applications maintained by hundreds of development and operations teams.

10.2 Creating a Template Spec

10.2.1 Listing Template Specs

10.2.2 Template Spec versions

10.2.3 Creating a Template Spec from multiple ARM templates

10.2.4 Deploying a Template Spec using IaC is impractical

10.3 Deploying a Template Spec

10.3.1    Deploying Template Specs from an ARM or Bicep template

10.3.2    Upgrading to a newer version of the Template Spec

10.4  An alternative: a Bicep Registry

10.5  Sharing Templates using a Package Manager

10.5.1    Publishing an ARM template as a package

10.5.2    Deploying an ARM template that is in a package

10.5.3    Yet another approach

10.6  Design considerations

10.6.1    Choosing an approach

10.6.2    Pros and Cons of Template Specs

10.6.3    Pros and Cons of using a Bicep Registry

10.6.4    Pros and Cons of using a package manager

10.7  Summary