Azure PowerShell and CLI Integrated Support for Bicep
If you’ve looked at the new Bicep language from Microsoft, you’ll know that it’s essentially an abstraction on top of ARM templates. To deploy resources, you are compiling the Bicep template into an ARM template which you then deploy. This compilation is usually achieved using the Bicep build
command, which outputs an ARM template, and then running the standard CLI commands to deploy the ARM template. This is a relatively simple process but was an additional step in the process with the potential for forgetting and deploying the old version of the template.
This is no longer the case; both the PowerShell and Azure CLI commands have been updated to accept native Bicep files. Of course, under the hood, they are still compiling them into ARM and deploying that, but you no longer have to care.
You will need to make sure that you update your AZ PowerShell modules or CLI to the latest version to get this support.
PowerShell
New-AzResourceGroupDeployment -Name "deployment" -ResourceGroupName "resourcegroup" -TemplateFile mytemplate.bicep -TemplateParameterFile mytemplate.params.json
CLI
az group deployment create --name "deployment" --resource-group "resourcegroup" --template-file mytemplate.bicep --parameters @mytemplate.params.json
Your parameters file will still be using the regular JSON ARM format; there’s no Bicep equivalent for this. You can still build the ARM template yourself with ```Bicep build`` if you want to debug what it is doing.
Thanks to Gregory Suvalian on YouTube for pointing out this update, as I hadn’t caught it initially.