{
  "$type": "site.standard.document",
  "canonicalUrl": "https://johnnyreilly.com/posts/bicep-meet-azure-pipelines-2",
  "description": "With Azure CLI, Bicep can be run in Azure Pipeline with minimal effort. Compile Bicep to ARM in a simple one-liner bash step.",
  "path": "/posts/bicep-meet-azure-pipelines-2",
  "publishedAt": "2021-03-23T00:00:00.000Z",
  "site": "at://did:plc:yy3apqjlms24kso7ahn7lbmb/site.standard.publication/3mova7c4nho2b",
  "tags": [
    "bicep",
    "azure pipelines",
    "azure"
  ],
  "textContent": "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.\n\n\n\nThe easier way\n\nThe target reader of the previous post was someone who was already using AzureResourceManagerTemplateDeployment@3 in an Azure Pipeline to deploy an ARM template. Rather than replacing your existing AzureResourceManagerTemplateDeployment@3 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:\n\nThis will take your Bicep template of azuredeploy.bicep, transpile it into an ARM template named azuredeploy.json which a subsequent AzureResourceManagerTemplateDeployment@3 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.\n\nIn 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:\n\nAnd when it's run, it may result in something along these lines:\n\nSo 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.",
  "title": "Bicep meet Azure Pipelines 2"
}