Organizing Resource Deployments Using Bicep

In the realm of cloud infrastructure management, efficient organization and deployment of resources are paramount. With Bicep modules, we can take resource deployment to the next level by organizing and simplifying our deployments. In this article, we will explore how Bicep modules can improve the readability, reusability, and maintainability of our infrastructure as code.

When working with Bicep, we often come across complex deployment scenarios that require multiple resources to be provisioned together. Bicep modules allow us to encapsulate these deployment details into reusable components, making our code more modular and easier to understand.

This is a new series of articles about ‘BiCep’ technology by Microsoft – it is a game changer for resource management in the cloud – well worth investigating if you are a cloud builder!

Key Takeaways:

  • Bicep modules enable the organization and encapsulation of deployment details.
  • Modules can be easily reused for different deployments.
  • Modules can be shared with others through template specs or registries.
  • Dependent modules can be defined using the dependsOn property.
  • Modules can be deployed conditionally and iteratively for more flexibility.

Creating Bicep Modules

In Bicep, modules are a powerful way to organize and encapsulate deployment details, making your resource deployments more manageable and reusable. Let’s explore the syntax, path, and parameters involved in creating Bicep modules.

Module Syntax

When defining a Bicep module, you use the module syntax, which includes the symbolic name, module path, and optional parameters. The module syntax looks like this:

module symbolicName = {
path =

The symbolicName is a symbolic representation of the module and will be used to reference the module in other parts of your Bicep file. The modulePath specifies the location of the module file, which can be a local file or a file in a module registry. Let’s explore the module path in more detail.

Module Path

The module path represents the location of the module file. It can be specified as a local file or a file in a registry, such as the public module registry or a private registry. Here’s how you can define the module path:

  1. If the module file is a local file, you can use a relative path. For example:

path = “./modules/myModule.bicep”

  1. If the module file is in the public module registry, you can use the predefined alias ‘br/public’. For example:

path = “br/public/myModule”

  1. If the module file is in a private module registry, you can use the following syntax:

path = “”

Replace registryName with the name of your private registry. Now that you understand how to define the module path, let’s explore module parameters.

Module Parameters

Parameters in a Bicep module allow you to pass values from the parent Bicep file to the module. They help customize and configure the behavior of the module based on your requirements. To define parameters in a Bicep module, you can use the following syntax:

param parameterName type = defaultValue

The parameterName represents the name of the parameter, the type defines the data type for the parameter, and the defaultValue sets the default value if no value is provided from the parent Bicep file.

With module syntax, module paths, and parameters, you have the building blocks to create and reference Bicep modules effectively. By leveraging modules, you can simplify your deployments and promote reusability across different projects.

Benefit Description
Modularity Break down complex deployments into manageable modules, improving readability and maintainability.
Reusability Easily reuse modules across different deployments, saving time and effort.
Parameterization Customize module behavior by passing parameters from the parent Bicep file.

Now that we have a clear understanding of module creation, let’s move on to Section 3 to explore module deployment and configuration.

Module Deployment and Configuration

When deploying modules in Bicep, there are various configuration options available to ensure smooth and efficient deployment of resources. Let’s explore some of these options:

Parallel Deployment and Dependencies

By default, modules are deployed in parallel, optimizing the deployment process and reducing overall deployment time. However, if a module has dependencies on other modules or resources, these dependencies can be explicitly defined using the dependsOn property in the module definition. This ensures that the dependent modules or resources are deployed before the current module.

Conditional Deployment

In some cases, you may want to deploy a module conditionally based on certain criteria. Bicep allows for conditional deployment using the if expression. By utilizing this expression, you can control whether a module gets deployed based on specific conditions, such as environment variables or parameters.

Iterative Deployment with Batch Size

In certain scenarios, you may need to deploy multiple instances of a module, such as when deploying resources across different regions or environments. Bicep provides the for expression with the batchSize decorator, allowing you to specify the number of instances to be deployed at once. This iterative deployment approach gives you greater flexibility and control over the deployment process.

Scope of Modules

The scope of a module refers to its deployment scope, which can be different from the main Bicep file’s scope. By adding the scope property to the module definition, you can specify where the module should be deployed. This allows you to deploy modules to different scopes within your Azure environment, providing a more granular and targeted deployment strategy.

Module deployment in Bicep offers flexibility and control over how resources are deployed. By utilizing these configuration options, you can optimize your deployment process, manage dependencies effectively, and ensure smooth resource provisioning in Azure.

Path to Module

In Bicep, a module can be sourced from different locations, depending on the specific deployment requirements and preferences. These locations include:

  • Local File: A module can be stored as a local file, allowing for easy access and management within the same directory as the main Bicep file. To reference a local module, the module path is specified using a relative path, indicating the file’s location on the local filesystem.
  • Public Module Registry: Bicep provides a public module registry, which serves as a centralized repository for storing and sharing modules. Modules hosted in the public registry can be accessed by specifying the predefined alias ‘br/public’ as the module path. This allows users to easily leverage community-contributed modules and maintain consistency across multiple deployments.
  • Private Module Registry: For organizations that require greater control and privacy over their modules, Bicep supports private module registries. These registries can be hosted on Azure Container Registry (ACR) or other private repositories. To reference modules from a private registry, the module path is specified using the ‘’ scheme, allowing for secure and controlled access to modules.
  • Template Spec: Bicep also provides integration with Azure Template Specs, which define a specific versioned template and its associated artifacts. Template specs are referenced using the ‘ts://:’ syntax, providing a way to source modules directly from a template spec and ensuring consistent and controlled deployment across environments.

“Bicep offers flexibility in sourcing modules from various locations, allowing users to choose the most suitable approach based on their deployment needs and organizational requirements.”

The table below summarizes the different paths to modules and their corresponding specifications:

Module Location Module Path Format
Local File Relative path to the module file
Public Module Registry br/public
Private Module Registry br:<registry-name>
Template Spec ts:<sub-id>/<rg-name>/<template-spec-name>:<version>

By leveraging these different module sourcing options, Bicep provides a flexible and efficient approach to building modular and reusable infrastructure deployments.


Bicep modules provide a powerful and efficient solution for organizing and simplifying resource deployments in Azure. By encapsulating deployment details and promoting reusability, these modules greatly enhance the maintainability and organization of infrastructure as code.

Whether you choose to utilize the module registry or template specs, Bicep modules offer a seamless deployment experience, contributing to a more efficient and scalable workflow. With Bicep modules, managing and deploying Azure resources becomes streamlined and easily manageable, allowing you to focus on other critical aspects of your projects.

By leveraging Bicep modules, your organization can achieve enhanced organization and maintainability, leading to improved collaboration among development teams. The modularity and encapsulation provided by Bicep modules enable different teams to work on specific modules, reducing the chances of conflicts and errors in resource deployment.

Overall, Bicep modules are a game-changer for resource deployment in Azure. With their ability to organize deployments, improve maintainability, and promote collaboration within your organization, Bicep modules are an indispensable tool for any organization seeking to optimize their infrastructure as code.


Right then, enough learning, go get cloud-lifting with Bicep 😀


Open-Source AI Models Gain Traction and Outperform Closed Models

Open-source AI models are revolutionizing the industry, surpassing the capabilities of closed models in specific tasks. Companies are recognizing the need for flexibility in their AI strategies and are gravitating towards alternatives that provide more autonomy and control. As a result, a significant number of businesses are projected to expand their AI adoption with open-source models in the coming years.

Benefiting from Open-Source Models

The advantages of open-source AI models extend beyond their superior performance. These models offer several key benefits for new AI startups:

  • Increased Innovation: Open-source models provide developers with access to a vast community of experts, fostering collaboration and innovation.
  • Market Adoption: By using open-source models, startups can align themselves with established frameworks and libraries, facilitating quicker market adoption.
  • Cost Efficiency: Open-source models significantly minimize development costs, allowing startups to allocate resources to other critical areas.
  • Customization: With open-source models, startups have the freedom to tailor and fine-tune algorithms to their specific requirements.

Incorporating open-source models into your AI development can give your startup a competitive advantage, enabling you to deliver innovative solutions to market faster and at a lower cost.

Comparing Open-Source and Closed Models

The performance of open-source AI models compared to closed models varies across different tasks and industries. Below is a comparison highlighting some of the key differences:

ComparisonOpen-Source AI ModelsClosed Models
Flexibility and TransparencyOpen-source models offer greater flexibility and transparency, allowing developers to tailor and understand algorithms.Closed models may lack transparency, limiting customization and control over the underlying algorithms.
Collaboration and CommunityOpen-source models benefit from a collaborative community, fostering continuous improvement and knowledge sharing.Closed models might have limited collaboration opportunities, hindering advancements and insights gained from collective expertise.
Cost-EffectivenessOpen-source models are typically more cost-effective, reducing development expenses and allowing efficient resource allocation.Closed models can be pricier due to licensing fees, making them less accessible, especially for startups with limited budgets.

While closed models may still be suitable for specific use cases, open-source models offer immense potential for innovation and customization, making them increasingly popular among AI startups.

Using Variables in Bicep

Variables in Bicep are a crucial feature for enhancing the readability, maintainability, and flexibility of your Azure Resource Manager (ARM) templates. They allow you to store and reuse values, making your code more concise and easier to manage. In this guide, we’ll explore the various aspects of using variables in Bicep, including how to define them, use them in resource definitions, expressions, outputs, and configuration settings.

This is a new series of articles about ‘BiCep’ technology by Microsoft – it is a game changer for resource management in the cloud – well worth investigating if you are a cloud builder!

Key Takeaways:

  • Variables in Bicep enable the definition of reusable expressions.
  • Using variables simplifies the development process.
  • W word of caution! … there is a limit of 256 variables per Bicep file., so don’t exceed this limit.
  • Variables can be used in various contexts, such as resource properties, output values, and iterative loops.

Defining Variables in Bicep

In Bicep, you can define variables using the ‘var‘ keyword followed by the variable name and its value. Here’s the syntax to define a variable in Bicep:

<variable-name> = <variable-value>


Syntax of Bicep Variable

Bicep infers the data type of the variable from its assigned value. This saves you time and effort by removing the need to explicitly declare the data type. For example, when setting a variable to a string value, you can use the following syntax:

var stringVar = ‘example value’

Using Variables in Resource Properties

One of the key benefits of variables is their ability to be used within the properties of Azure resources defined in your Bicep file. By referencing variables in resource properties, you can dynamically set values based on your defined variables. For example, you can use a variable to set the name of a storage account or the location of a resource, enabling more flexibility in your Azure resource configurations.

Heres a simple example:

Using Variables in Resource Definitions in Bicep

Using Variables in Iterative Loops

Variables can also be used within iterative loops in Bicep. This is useful when you need to create arrays of objects. Using the “for” keyword with the “range” function, you can iterate a specified number of times and define the properties of each object using the loop index. This enables you to generate arrays with consistent and predictable data structures.

For example, you can use iterative loops and variables in Bicep to create an array of data disks. Each object in the array can have properties such as disk name, disk size, and disk index, making it easy to manage and maintain the array’s data structure.

Bicep Variables in Iterative Loops

Leveraging Configuration Variables for Environment Settings

Bicep provides a powerful feature called configuration variables that enables you to manage environment-specific values for your Azure deployments. These variables are defined as objects with key-value pairs, with each key representing an environment name and each value representing the configuration settings for that specific environment.

For instance, you can define a configuration variable that holds values for both the “test” and “prod” environments.

Configuration Variables in Bicep

Constructing Variables with Expressions

Variables can be constructed using expressions, allowing for dynamic value generation. This is particularly useful when creating resource names or constructing values based on other parameters or variables.


Mastering Bicep Variables – Tips and Best Practices

When it comes to working with variables in Bicep, there are several best practices that can help you write more efficient and maintainable infrastructure as code. By following these guidelines, you can unlock the full potential of Bicep variables and ensure efficient coding practices.

Best Practice Description
Use Descriptive Variable Names Choose meaningful names that clearly convey the purpose of each variable.
Avoid Naming Conflicts Ensure that variable names do not overlap with parameters, modules, or resources in your Bicep file.
Leverage Functions and Expressions Take advantage of Bicep’s built-in functions to create dynamic and reusable variable values.
Organize Variables Logically Group related variables together and provide clear documentation for each variable.
Test and Validate Variables Verify that variables are resolving as expected and providing the correct values.
Documentation Document the purpose and usage of each variable to facilitate understanding and future maintenance.


Remember, variables in Bicep offer a powerful mechanism for simplifying template development by abstracting complex expressions and values. By utilizing variables effectively, you can enhance the readability, maintainability, and flexibility of your ARM templates, making them more efficient and easier to manage.

Happy cloud building!


ps: if you need a deeper dive, check out this documentation: