You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Bicep is a domain-specific language (DSL) for deploying Azure resources. It provides a cleaner, more concise syntax compared to raw ARM template JSON, while compiling down to ARM templates behind the scenes. Microsoft considers Bicep the recommended authoring experience for Azure IaC.
ARM templates work, but JSON is verbose. Consider a simple storage account:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]"
}
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2023-01-01",
"name": "mystorageaccount",
"location": "[parameters('location')]",
"sku": { "name": "Standard_LRS" },
"kind": "StorageV2",
"properties": {
"minimumTlsVersion": "TLS1_2"
}
}
]
}
param location string = resourceGroup().location
resource storageAccount 'Microsoft.Storage/storageAccounts@2023-01-01' = {
name: 'mystorageaccount'
location: location
sku: {
name: 'Standard_LRS'
}
kind: 'StorageV2'
properties: {
minimumTlsVersion: 'TLS1_2'
}
}
The Bicep version is shorter, easier to read, and eliminates JSON boilerplate.
| Benefit | Description |
|---|---|
| Concise syntax | No curly-brace nesting hell or repeated schema references |
| Type safety | IntelliSense and compile-time validation in VS Code |
| No state management | Bicep compiles to ARM; Azure manages the state |
| Modules | First-class support for modular, reusable templates |
| Automatic dependency detection | No dependsOn needed in most cases |
| Day-one resource support | Any ARM resource is available in Bicep immediately |
| Transparent compilation | You can always inspect the generated ARM JSON |
Bicep is included with the Azure CLI (version 2.20+):
az bicep install
az bicep upgrade
az bicep version
Or install the standalone CLI:
# macOS
brew install bicep
# Windows
winget install Microsoft.Bicep
Install the Bicep VS Code extension for IntelliSense, syntax highlighting, and error detection.
@description('The deployment environment')
@allowed(['dev', 'staging', 'prod'])
param environment string = 'dev'
@description('Azure region')
param location string = resourceGroup().location
@secure()
@description('Administrator password')
param adminPassword string
param instanceCount int = 2
param enableDiagnostics bool = true
param tags object = {
project: 'webapp'
costCentre: '12345'
}
var storageAccountName = 'st${environment}${uniqueString(resourceGroup().id)}'
var vnetName = 'vnet-${environment}'
var commonTags = {
environment: environment
managedBy: 'bicep'
}
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.