Last time I wrote about how to use the Azure CLI to run Bicep within the context of an Azure Pipeline. The solution was relatively straightforward, and involved using
az deployment group create in a task. There's an easier way.
The target reader of the previous post was someone who was already using
[email protected] in an Azure Pipeline to deploy an ARM template. Rather than replacing your existing
[email protected] tasks, all you need do is insert a prior
bash step that compiles the Bicep to ARM, which your existing template can then process. It looks like this:
This will take your Bicep template of
azuredeploy.bicep, transpile it into an ARM template named
azuredeploy.json which a subsequent
[email protected] task can process. Since this is just exercising the Azure CLI, using
bash is not required; powershell etc would also be fine; it's just required that the Azure CLI is available in a pipeline.
In fact this simple task could even be a one-liner if you didn't fancy using the
displayName. (Though I say keep it; optimising for readability is generally a good shout.) A full pipeline could look like this:
And when it's run, it may result in something along these lines:
So if you want to get using Bicep right now with minimal effort, this an on ramp that could work for you! Props to Jamie McCrindle for suggesting this.