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.
// 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"
}
]
}
// 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.
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:
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.