What is Bicep - Bicep is a transpiler that converts new Bicep Language to ARM templates. We will look into Bicep language in a second. Before that, let’s take a step back and understand why this was introduced.
If you have been working with JSON ARM templates, you would have noticed how cumbersome it can be when it is large. There are problems with current JSON ARM templates
Microsoft wants to simplify this and ensure only one path to deploy on Azure. But, Azure Resource Manager is huge and it has APIs for every service in Azure that works with Json ARM template. Its a huge work to change this. So, instead of making changes to Azure Resource Manager, Microsoft has introduced a new language called Bicep and built a transpiler that converts bicep language to ARM templates.
The bicep is a transpiler. A transpiler that converts the new Bicep language into ARM Templates.
Follow the instructions below.
https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/installvar storageAccountName = 'strgaazfunction'resource storageAccount 'Microsoft.Storage/storageAccounts@2022-05-01' = {name: storageAccountNamelocation: locationsku: {name:'Standard_LRS'}kind: 'Storage'}
It is
We will deploy a simple Azure function bicep template using Azure devops pipeline.
Download the bicep template for azure functions here - git repo
For a detailed walk-through, refer to the YouTube video shared above
# Starter pipeline# Start with a minimal pipeline that you can customize to build and deploy your code.# Add steps that build, run tests, deploy, and more:# https://aka.ms/yamltrigger: nonepool:vmImage: ubuntu-lateststages:- stage: Lintjobs:- job: LintCodedisplayName: Lint Codesteps:- script: |az bicep build --file function-consumption-plan/storage.bicepname: LintBicepCodedisplayName: Run Bicep Linter- stage: Validatejobs:- job: ValidateBicepCodedisplayName: Validate Bicep Codesteps:- task: AzureCLI@2name: RunPreflightValidationdisplayName: Run Preflight Validationinputs:azureSubscription: 'Subscription-PAYG'scriptType: 'bash'scriptLocation: 'inlineScript'inlineScript: |az deployment group validate --resource-group $(resourceGroupName) \-f function-consumption-plan/storage.bicep \--parameters function-consumption-plan/storage.parameters.json- stage: Deployjobs:- job: Deploysteps:- task: AzureCLI@2name: DeploydisplayName: Deploy to Azureinputs:azureSubscription: 'Subscription-PAYG'scriptType: 'bash'scriptLocation: 'inlineScript'inlineScript: |az deployment group create --name $(Build.BuildNumber) --resource-group $(resourceGroupName) \-f function-consumption-plan/storage.bicep \--parameters function-consumption-plan/storage.parameters.json
Legal Stuff