Here’s my top 5 Azure Bicep tips & tricks to get you started! Be sure to have the VSCode extension installed.
If you’re interested in checking out some real world examples for Bicep please checkout my GitHub project Bicepify where I break down concepts into friendlier learning chunks. I update the repository frequently so be sure to star if you find it useful!
Now onto the first Azure Bicep tips & tricks:
1. Auto load required parameters from Bicep modules
Did you know you can auto-load module parameters in module blocks by simply using CNTRL+SPACE
to auto load the 'params:
‘. This shortcut works with viewing most auto-completions in Bicep code.
While you’re here, check out my post on how to consume Azure Bicep modules and your options: Consuming Bicep modules – What are my options? – Rios Engineer
2. Easily import your existing Azure resources
Missing some Azure resources from your file, or maybe you are starting your IaC journey and need to retrospectively add resources? No problem in Bicep.
Locate an Azure Resource in the portal you want to import. On the overview page there is a ‘JSON View’ hyperlink, copy the Resource ID. Then in VSCode extension can do the rest:
3. Visualise your Azure Bicep
You can also automatically visualise your resources by right clicking the file and select ‘Open Bicep Visualizer’. Currently no way to save these, a much requested feature though.
4. Leverage Azure Verified Modules (AVM) for Azure Bicep Modules
Did you know about Azure Verified Modules? It aims to set the standards for what good Infrastructure as Code modules look like and that includes Azure Bicep modules!
These Azure Bicep modules are already written for you, with Azure best practice & Bicep standards baked in by design. Using these modules will save you reinventing the wheel or wasting time writing an Azure Bicep module that most likely already exists for your consumption.
You can view the Bicep module list for use below here:
Bicep Resource Modules | Azure Verified Modules
5. Use metadata descriptions in your Azure Bicep files
When building out your code, it’s important to label parameters with metadata descriptions so others can easily pickup and understand. It’s also best practice so a good habit to get into!
Here’s some examples:
@description('Conditional. The current date and time.')
param dateTime string = utcNow()
@description('Conditional. Location of the resource.')
param location string = resourceGroup().location
@description('Optional. ID of the log analytics workspace to be linked to the deployed.')
param linkedWorkspaceResourceId string = ''
BICEPAnd that concludes my top 5 Azure Bicep tips & tricks!
Latest Posts
Never miss an update: Azure Verified Modules with GitHub Bot & Teams
Getting started: Continuous deployment with Azure Bicep and Azure DevOps
Eliminate old API versions in your Azure Bicep templates