What is Bicep? – DEV Community

Azure Bicep

Azure Bicep is a brand new Area-Particular Language (DSL) for declaratively deploying Azure assets. Bicep just isn’t a normal objective programming language however a clear abstraction for Azure Useful resource Supervisor (ARM) Templates. This ensures that the properties which might be legitimate in ARM templates are legitimate in Bicep as nicely.

Advantages of Bicep

Bicep supplies the next benefits:

  1. Assist for all useful resource sorts and API variations
  2. Easy syntax
  3. Authoring expertise
  4. Repeatable outcomes
  5. Orchestration
  6. Modularity
  7. Integration with Azure providers
  8. Preview adjustments
  9. No state or state information to handle
  10. No price and open supply

Why Bicep?

ARM templates are JSON paperwork that supply a declarative method of defining our Azure infrastructure and configuration. ARM template language presents built-in capabilities and different language constructs reminiscent of loops and that assist us to create extra dynamic infrastructure definitions.

Nonetheless, the JSON syntax for ARM templates makes the paperwork fairly verbose and restricts the extensibility since we’ve got to play what’s supported inside JSON information illustration.

Because the complexity of the infrastructure grows, our ARM template turns into virtually unreadable and tough to take care of as nicely. There are options to ARM template deployment. Particularly, HashiCorp Terraform or Pulumi SDK. These instruments don’t use ARM templates however present alternate methods to outline our infrastructure as code.

The next examples present the distinction between a Bicep file and the equal JSON template. Each examples deploy a storage account.

param storageAccountName string
param accessTier string = 'Scorching'
param location string = 'WestUS2'

useful resource sa 'Microsoft.Storage/storageAccounts@2019-06-01' = {
  title: storageAccountName
  location: location
  sku: {
    title: 'Standard_LRS'
  variety: 'StorageV2'
  properties: {
    accessTier: accessTier
Enter fullscreen mode

Exit fullscreen mode

The 26 traces within the above instance is what we have to create a reusable Bicep file that may generate ARM template to provision an Azure storage account. This, when compiled, produces the next ARM template.

  "$schema": "https://schema.administration.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "",
  "parameters": {
    "storageAccountName": {
      "sort": "string"
    "accessTier": {
      "sort": "string",
      "defaultValue": "Scorching"
    "location": {
      "sort": "string",
      "defaultValue": "WestUS2"
  "capabilities": [],
  "assets": [
      "type": "Microsoft.Storage/storageAccounts",
      "apiVersion": "2019-06-01",
      "name": "[parameters('storageAccountName')]",
      "location": "[parameters('location')]",
      "sku": {
        "title": "Standard_LRS"
      "variety": "StorageV2",
      "properties": {
        "accessTier": "Scorching"
  "metadata": {
    "_generator": {
      "title": "bicep",
      "model": "",
      "templateHash": "6796585337478950038"
Enter fullscreen mode

Exit fullscreen mode

The generated template is sort of twice the dimensions of the Bicep file. This ARM template might be deployed by supplying the required parameter values as one other JSON or on the command line when utilizing Azure CLI or Azure PowerShell.

It is a instance the place it exhibits the pliability that we’re having with this language of its personal to generate the ARM templates. Bicep supplies not simply the constructs of a typical programming language but additionally a option to compose our Azure infrastructure definitions as smaller reusable modules.

To be taught extra about Azure Bicep refer Bicep documentation

Thanks for studying my article until finish. I hope you realized one thing particular right this moment. If you happen to loved this text then please share to your folks and if in case you have options or ideas to share with me then please write within the remark field.

Add a Comment

Your email address will not be published. Required fields are marked *