Cloud can be tricky sometimes. Find out what scenarios we've ran into that are worth being mentioned and explained.
If you are one of the many who caught interest in the Bicep Project and you want to deploy the Bicep configurations that you have created by using Azure DevOps, you are in luck! In today’s blog post I want to present the steps on how to deploy an Azure Bicep file via Azure DevOps.
Let’s start from the beginning and define what represents Project Bicep
Project Bicep is the Next Generation of ARM templates, as Bicep represents a Domain Specific Language (DSL) for ARM templates.
Azure Bicep’s scope is defined in the documentation (https://github.com/Azure/bicep) as aiming to simplify as much as possible the authoring experience by presenting a cleaner syntax and better support for modularity and re-use of code. As such, Bicep represents a transparent abstraction over ARM and ARM templates, meaning that everything that can be done in ARM Template, can also be done in Bicep.
If you are interested to see some examples of Azure Bicep configurations, you can check this link: https://github.com/Azure/bicep/tree/main/docs/examples
Let me show you a Bicep sample configuration
Before starting this, I also recommend the Bicep extension for VSCode, which contains a built-in Intellisense (https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-bicep)
My goal is to deploy an Azure Virtual Network by using the Bicep file.
At this point we have a sample configuration for which I created an Azure DevOps stage containing one job and two tasks, as follows:
- Task1 is Bash@3 which will build ARM template from bicep file (main.bicep)
- Task2 is AzureCLI@2 which will create a resource group for the ARM configuration to be deployed to along with deploying the ARM template (.json file) from Task1
And here you have the Azure DevOps Full Pipeline:
This is how the completed Pipeline looks like: