Posted in

Bicep CLI β€” and Especially the Bicep Console

πŸ”Ή Feature: Bicep CLI β€” and Especially the Bicep Console
πŸ”Ή What It Does: The Bicep CLI is so much more than just a compiler to ARM JSON. It builds, lints, restores, decompiles, formats, snapshots, and offers JSON-RPC β€” but the standout feature is bicep console, a fully interactive REPL where you can type Bicep expressions and instantly see the results. A safe, local playground for your infrastructure code. πŸ§ͺ

What Is It Giving You:

βœ… Instant Expression Evaluation: Type any valid Bicep expression and see the output immediately β€” no build, no deploy, no Azure round-trip. Learning a new function? Test it live.
βœ… Variables + Multi-Line Support: Declare variables using var and reuse them. Multi-line complex expressions are supported with automatic structural detection.
βœ… Real-Time Syntax Highlighting: Input and output are colorized so you catch mistakes before they reach a template. Supports nearly all Bicep functions.
βœ… Unit-Test Your User-Defined Functions: Validate your UDFs return exactly what you intend β€” no deployment required. Prototype, verify, and then commit.
βœ… Validate AI-Generated Code Safely: Paste Copilot-generated Bicep functions into the console to confirm correctness before trusting them in production.
βœ… Automation-Ready stdin/stdout: Since v0.40.2, piping input and output is supported. Use it in scripts or CI to auto-test functions without hacks.
βœ… Already in Your Toolbox: Azure CLI 2.20.0+ includes Bicep CLI automatically. Launch the REPL with bicep console (v0.42.1+ required).

The Full Bicep CLI Lineup:
πŸ”§ build β€” compile Bicep to ARM JSON
πŸ”§ lint β€” catch errors and linter-rule violations
πŸ”§ restore β€” pull external modules to local cache
πŸ”§ snapshot β€” offline diff of your infra logic
πŸ”§ jsonrpc β€” programmatic JSON-RPC interface
πŸ”§ console β€” the interactive REPL playgrounde REPL playground

πŸš€ The shift: Stop creating throwaway test deployments just to see what a function does. Open the console and get your answer in one line.

πŸš€snapshot β€” generate a normalized JSON of your infra to diff offline, perfect for comparing environments (DEV vs TEST vs PROD) or catching unintended logic drift between two versions of your templates without ever touching Azure

🌐 https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-cli
🌐 https://github.com/Azure/bicep/blob/main/docs/experimental/console-command.md

Microsoft Certified Trainer, Office 365, AWS, Azure and Cloud Expert-Architect. In the IT world for over than 20 years.

Apart from the main area of Microsoft Azure expert in the field of infrastructure servers Windows Server 2003-2019, Microsoft Active Directory, Hyper-V Private Cloud, IIS, System Center, SQL.

Private Cloud, System Center, Hyper-V, Open Stack Expert and all Microsoft products Expert. Linux Server administrator.

My Azure community projects:

https://mazeball.azurewebsites.net/
https://github.com/MariuszFerdyn?tab=repositories

More