Bicep is a domain-specific language (DSL) for deploying Azure resources using declarative Infrastructure-as-Code (IaC). Bicep simplifies ARM template authoring with cleaner syntax, better tooling, and improved type safety. Unlike verbose JSON, Bicep provides concise, readable resource definitions while compiling to ARM templates transparently. The key insight: Bicep uses symbolic names instead of string-based resource IDs, enabling strong type checking and IntelliSense — this makes cross-resource references natural and safe, drastically reducing deployment errors compared to traditional ARM JSON.
What This Cheat Sheet Covers
This topic spans 17 focused tables and 151 indexed concepts, 113 flashcards. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
A jump-to index of every table row in this cheat sheet.
An interactive map of every table and concept in this topic.
Table 1: Core Language Syntax
These are the building blocks you reach for in nearly every Bicep file — declaring resources, taking inputs, computing values, and returning results. Get comfortable with symbolic names, parameters, variables, and modules first; almost everything else builds on them.
| Element | Example | Description | |
|---|---|---|---|
resource stg 'Microsoft.Storage/storageAccounts@2023-01-01' = { ... } | • Declares an Azure resource with a symbolic name, type, API version, and properties • symbolic name enables strongly-typed references throughout the file. | ||
param location string = 'eastus' | • Declares an input parameter with type and optional default • accepts values at deployment time for flexibility across environments. | ||
var storageName = 'mystg${uniqueString(resourceGroup().id)}' | • Compile-time variable that simplifies expressions • reduces duplication and improves readability. | ||
output storageId string = stg.id | • Returns a deployment value • passes data to calling templates or displays results post-deployment. | ||
module myModule './module.bicep' = { params: { ... } } | • References another Bicep file for reuse • encapsulates logic and promotes modular infrastructure design. | ||
resource kv 'Microsoft.KeyVault/vaults@2023-02-01' existing = { name: 'myKv' } | • References a resource not deployed by this file • enables property access and child resource deployment without redeployment. | ||
targetScope = 'subscription' | Sets deployment scope to resourceGroup (default), subscription, managementGroup, or tenant. | ||
name: 'vm-${environment}-${location}' | • Embeds expressions in strings using ${ } syntax• cleaner than concat() for building names. | ||
script: ''' #!/bin/bash echo "Hello" ''' | • Triple single quotes ''' preserve content exactly as written• supports scripts and large text blocks. | ||
// Single-line comment/* Multi-line */ | • Uses // and /* */ comment syntax• not included in compiled ARM template. |