Sunday, May 7, 2023

Azure Bicep public registry

 

One of the great benefits of Bicep Infrastructure is Code is reusing your code. Leveraging modules within Bicep is the perfect example of that. By using these features of Bicep, you can write reusable code that can be shared and used across multiple deployments. This can save time and effort and help ensure consistency across your Azure resources.

Some examples on how to reuse your code are:

Parameters: Bicep allows you to parameterize your code so you can define parameters that can be passed in when the code is deployed. This makes it easy to reuse code with different configurations or environments. For example, you might define a parameter for the name of a Vnet, which can be passed in when the code is deployed in different environments.

loops: Bicep allows you to use loops to create multiple instances of a resource. This is very useful when you need to create multiple resources with similar configurations. For example, you might use a loop to create multiple virtual machines

To me, the most useful example of reusability within Bicep in using Modules. Bicep allows you to create reusable modules that contain a definition of one or more Azure resources. You can define a module once and then reuse it in multiple Azure deployments. Modules can be stored in a separate Bicep file, which makes it easy to share them with others, for example by placing them in registries or template specs.

You might already be familiar with the concept of private registries based on Azure Container Registry (ACR) resources in Azure. You can store Bicep Modules inside in ACR and share those within your team, company, or to anyone who you provide access. To process to create an ACR and add your Bicep modules is very straight forward and explained here: Create private registry for Bicep module — Azure Resource Manager | Microsoft Learn.

But did you know that Microsoft is also continuously working on expanding modules inside their Public Registry? This Public Registry is based on Microsoft Container Registry (MCR).

This is the new location where you can find all Bicep modules provided in the public registry

aka.ms/br-module-index

These are nicely ordered and easy to navigate:

aka.ms/br-module-index

Contributing to these modules is currently limited to Microsoft employees, but you can propose new modules or report bugs by opening an issue via GitHub.

Looking to get started with Bicep? I published a book on how to get started, which covers reusing your code and much more! Available on Amazon in Kindle, Paperback, and hard copy format!

https://www.amazon.com/Getting-started-Bicep-Infrastructure-Azure/dp/B098WK3MR7

No comments:

Post a Comment