Azure Bicep Preview: ARM Templates Made Simple

On this page

March 2020 marks the initial public preview of Project Bicep, a domain-specific language (DSL) for deploying Azure resources. It aims to drastically simplify the verbose JSON syntax of ARM templates. While still experimental (v0.1), it offers a glimpse into the future of Azure Infrastructure as Code.

Bicep vs ARM JSON

Bicep is a transparent abstraction over ARM. It compiles down to standard ARM JSON, meaning Day 0 support for all resource providers.

JSON14 lines
// ARM Template (Before)
{
  "$schema": "...",
  "resources": [
    {
      "type": "Microsoft.Storage/storageAccounts",
      "apiVersion": "2019-06-01",
      "name": "[parameters('storageName')]",
      "location": "[resourceGroup().location]",
      "sku": { "name": "Standard_LRS" },
      "kind": "StorageV2"
    }
  ]
}
Bicep10 lines
// Bicep (After)
param storageName string
param location string = resourceGroup().location

resource storage 'Microsoft.Storage/storageAccounts@2019-06-01' = {
  name: storageName
  location: location
  sku: { name: 'Standard_LRS' }
  kind: 'StorageV2'
}

Modules and Outputs

Bicep introduces first-class modularity, replacing nested templates.

Bicep8 lines
module stg './storage.bicep' = {
  name: 'storageDeploy'
  params: {
    storageName: 'mystorage'
  }
}

output storageId string = stg.outputs.id

Decompiling ARM

You can convert existing JSON templates to Bicep to learn the syntax:

Bash1 line
bicep decompile main.json

Key Takeaways

  • Bicep reduces LoC by ~50% compared to JSON.
  • Compiles to standard ARM templates; no runtime changes.
  • Excellent VS Code tooling (IntelliSense, validation).

Discover more from C4: Container, Code, Cloud & Context

Subscribe to get the latest posts sent to your email.

Written by

Nithin Mohan TK

Hello Namaste! 👋🏻 I'm an accomplished Enterprise Solution Architect & Engineering Leader with 20+ years of progressive experience architecting, building, and scaling transformative enterprise solutions. ⚜️ Solution Architect / AI & Cloud 📌 Galway, Ireland

Leave a comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.