Azure Bicep: Modules for Versatile Useful resource Administration


Howdy everybody! We’ve been on an thrilling journey exploring Azure Bicep. We’ve seen what it’s and the way it compares to ARM templates, arrange our surroundings, dived into its syntax, and explored parameters, sources, variables, and outputs. At the moment, we’re going to take one other step ahead. We’ll discover one of many key elements of Azure Bicep – Modules. So, let’s get began!

Logging in to Azure

Earlier than we begin, let’s guarantee we’re logged into Azure. Right here’s how you are able to do it:

  1. Open your terminal or command immediate: You need to use any terminal or command immediate that you simply’re comfy with.
  2. Log in to Azure: Use the az login command to log in to Azure.
    # Log in to Azure
    az login
  3. Set your subscription: Use the az account set command to set your subscription.
    # Set your subscription
    az account set --subscription "YourSubscriptionName"

Azure Bicep Modules

Modules in Azure Bicep are like capabilities in a programming language. They let you encapsulate a set of sources right into a reusable part. This makes your Bicep information extra versatile and reusable.

You may outline a module utilizing the module key phrase. Right here’s an instance.

module storageAccount './storageAccount.bicep' = {
  title: 'storageAccountModule'
  params: {
    storageAccountName: 'mystorageaccount'

On this instance, storageAccount is a module that references the storageAccount.bicep file. The title property of the module is ready to ‘storageAccountModule’, and the params property is used to go parameters to the module.

Right here’s an instance of a storage account. bicep file that can be utilized as a module.

param storageAccountName string

useful resource storageAccount 'Microsoft.Storage/storageAccounts@2021-04-01' = {
  title: storageAccountName
  location: resourceGroup().location
  sku: {
    title: 'Standard_LRS'
  type: 'StorageV2'

On this instance, the storage Account Title parameter is handed from the principle Bicep file to the module.


Nicely finished! You’ve simply discovered how one can use modules in Azure Bicep. Modules are a robust characteristic that lets you encapsulate a set of sources right into a reusable part. In our subsequent session, we’ll discover capabilities in Azure Bicep. So, keep tuned and continue to learn

Know extra about our firm at Skrots. Know extra about our providers at Skrots Providers, Additionally checkout all different blogs at Weblog at Skrots

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button