Skip to content
The Lazy Administrator
  • Home
  • Disclaimer
  • Contact
  • About Me
  • Search Icon

The Lazy Administrator

Finding ways to do the most work with the least effort possible

Getting Started with Bicep, an ARM DSL for Azure

Getting Started with Bicep, an ARM DSL for Azure

February 10, 2022 Brad Wyatt Comments 1 comment

Table of Contents

  • What is Azure Bicep
  • Getting Started with Bicep
    • Installing Bicep
      • MacOS
      • Windows
      • Linux
    • Install VSCode Extension
    • Upgrading Bicep
    • List Bicep Version
    • Launching Bicep
  • Next: Building Your First Bicep Template
  • Sources

Note: This is one part of a several part blog series that goes through Azure Bicep

What is Azure Bicep

Bicep is a Domain Specific Language or DSL, for deploying Azure resources in a declarative manner. It ‘aims to drastically simplify the authoring experience with a cleaner syntax and better support for modularity and code re-use. Bicep is a transparent abstraction over ARM and ARM templates, which means anything that can be done in an ARM Template can be done in Bicep.’1

Bicep moves away from the JSON syntax used by ARM Templates to something similar to HCL in Terraform. The end result is a syntax that is easier to both read and write. Bicep code is converted into ARM Template code (JSON), and then the resulting ARM Template code (JSON) is used to deploy your Azure resources.

Bicep transpile process.  source: https://medium.com/codex/arm-templates-or-azure-bicep-what-should-i-use-14e8662d3f27

One of the key benefits to Bicep to another DSL like Terraform is with Bicep there is no state file that you need to manage and keep. Your Azure environment is your state file, and Bicep will compare your Azure resources with your Bicep template. Also, there is day 0 support for new resource types and API versions, meaning any Azure resource — whether in private or public preview or GA — can be provisioned using Bicep.

Getting Started with Bicep

There are two items you need to get started. Install the Bicep CLI, which allows you to transpile your Bicep code to ARM templates as well as decompile, and the second item is to install the VSCode extension. The VSCode extension is optional but highly recommended.

Installing Bicep

MacOS

Homebrew is the easiest way to manage your CLI install. It provides convenient ways to install, update, and uninstall. If you don’t have homebrew available on your system, install homebrew before continuing.

You can install the Azure CLI on macOS by updating your brew repository information, and then running the install command:

brew update && brew install azure-cli

With the Azure CLI installed, you can now install the Bicep binaries

Important: Azure CLI installs a self-contained instance of the Bicep CLI. This instance doesn’t conflict with any versions you may have manually installed. Azure CLI doesn’t add Bicep CLI to your PATH.

az bicep install

You can also install it onto your system not containerized within Az CLI and added to your PATH by running the following

# Add the tap for bicep
brew tap azure/bicep

# Install the tool
brew install bicep

Windows

With Windows, you can install the Azure CLI using the MSI installer provided here: Install the Azure CLI for Windows | Microsoft Docs

Once you follow the installer prompts, launch PowerShell and run the following code to install the Bicep binaries

Important: Azure CLI installs a self-contained instance of the Bicep CLI. This instance doesn’t conflict with any versions you may have manually installed. Azure CLI doesn’t add Bicep CLI to your PATH.

az bicep install

You can also install it onto your system not containerized within Az CLI and added to your PATH by running the following

# Create the install folder
$installPath = "$env:USERPROFILE\.bicep"
$installDir = New-Item -ItemType Directory -Path $installPath -Force
$installDir.Attributes += 'Hidden'
# Fetch the latest Bicep CLI binary
(New-Object Net.WebClient).DownloadFile("https://github.com/Azure/bicep/releases/latest/download/bicep-win-x64.exe", "$installPath\bicep.exe")
# Add bicep to your PATH
$currentPath = (Get-Item -path "HKCU:\Environment" ).GetValue('Path', '', 'DoNotExpandEnvironmentNames')
if (-not $currentPath.Contains("%USERPROFILE%\.bicep")) { setx PATH ($currentPath + ";%USERPROFILE%\.bicep") }
if (-not $env:path.Contains($installPath)) { $env:path += ";$installPath" }
# Verify you can now access the 'bicep' command.
bicep --help
# Done!

Linux

To install Bicep on Linux run the following code

# Fetch the latest Bicep CLI binary
curl -Lo bicep https://github.com/Azure/bicep/releases/latest/download/bicep-linux-x64
# Mark it as executable
chmod +x ./bicep
# Add bicep to your PATH (requires admin)
sudo mv ./bicep /usr/local/bin/bicep
# Verify you can now access the 'bicep' command
bicep --help
# Done!

Install VSCode Extension

To install the VSCode extension, launch VSCode and go to Extension on the left pane and search for ‘Bicep.’

Upgrading Bicep

If you have Bicep containerized within Az, you can easily upgrade it by running the following command

az bicep upgrade

List Bicep Version

To list the Bicep version installed in Az, run the following command

az bicep version

Launching Bicep

Now that you have Bicep installed you need to know how to launch it. If you installed it into the Az CLI run the following command to verify that it is installed

az bicep --help

If Bicep is installed locally and added to your PATH you can just run the following command

bicep --help

Next: Building Your First Bicep Template


Sources

1: Azure/bicep (github.com)

Brad Wyatt
Brad Wyatt

My name is Bradley Wyatt; I am a 5x Microsoft Most Valuable Professional (MVP) in Microsoft Azure and Microsoft 365. I have given talks at many different conferences, user groups, and companies throughout the United States, ranging from PowerShell to DevOps Security best practices, and I am the 2022 North American Outstanding Contribution to the Microsoft Community winner.


Azure, Bicep
ARM, Azure, Bicep, IaaC, JSON

Post navigation

PREVIOUS
A PowerShell Game you can Compete with People Online – Feature Update to PSWordle
NEXT
Getting Started with Bicep: Building Your First Bicep Template

One thought on “Getting Started with Bicep, an ARM DSL for Azure”

  1. Santosh Mohapatra says:
    November 17, 2023 at 1:48 am

    Great Notes. Thank you so much.

    Reply

Leave a Reply Cancel reply

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

Subscribe

Email


Categories

  • Active Directory (8)
  • AI (3)
  • API (1)
  • AutoPilot (2)
  • Azure (15)
  • Bicep (4)
  • Connectwise (1)
  • Defender for Cloud Apps (1)
  • Delegated Admin (1)
  • DevOps (6)
  • Graph (6)
  • Intune (15)
  • LabTech (1)
  • Microsoft Teams (6)
  • Office 365 (19)
  • Permissions (2)
  • PowerShell (50)
  • Security (1)
  • SharePoint (3)
  • Skype for Business (1)
  • Terraform (1)
  • Uncategorized (2)
  • Yammer (1)

Recent Comments

  • Mike D on Upload a file to Connectwise and Attach it to a Service Ticket with PowerShell
  • Side Eye on Homeland Security’s Trusted Travelers API and PowerShell – Getting a Better Global Entry Interview Using PowerShell
  • Lisa on Allow Non-Admin Users to Manage Their Desktop Icons Using Intune
  • A1 Lottery LOGIN on Get a New Computer’s Auto Pilot Hash Without Going Through the Out of Box Experience (OOBE)
  • Kristopher Gates on Getting Started with GitHub Copilot in the CLI

1,752,879 People Reached

© 2025   All Rights Reserved.