10 Template specs and Bicep registries: Building a repository of templates

 

This chapter covers

  • Storing ARM and Bicep templates as reusable Azure resources
  • 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 infrastructure, like virtual machines, Kubernetes, or App Service plans. No one will want to write the same ARM or Bicep templates over and over to create that infrastructure. And besides the repetitive work, most companies have standard approaches to this infrastructure that they will want to impose on every team. In this chapter, you’ll learn how to store ARM or Bicep templates in Azure and make them available for others to reuse.

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

Summary