LinuxCommandLibrary

az-bicep

Deploy Azure resources using Bicep files

TLDR

Install Bicep CLI

$ az bicep install
copy

Build a Bicep file
$ az bicep build [[-f|--file]] [path/to/file.bicep]
copy

Attempt to decompile an ARM template file to a Bicep file
$ az bicep decompile [[-f|--file]] [path/to/template_file.json]
copy

Upgrade Bicep CLI to the latest version
$ az bicep upgrade
copy

Display the installed version of Bicep CLI
$ az bicep version
copy

List all available versions of Bicep CLI
$ az bicep list-versions
copy

Uninstall Bicep CLI
$ az bicep uninstall
copy

SYNOPSIS

az bicep <subcommand> [options]

Examples:
Compile a Bicep file:
az bicep build --file main.bicep

Install the Bicep CLI:
az bicep install

PARAMETERS

build
    Compiles a Bicep file into an Azure Resource Manager (ARM) template.

decompile
    Decompiles an existing ARM template JSON file back into a Bicep file.

generate-params
    Generates a parameter file (e.g., JSON or bicepparam) for a Bicep file based on its declared parameters.

install
    Installs the Bicep CLI for use with the Azure CLI.

list-versions
    Lists available Bicep CLI versions that can be installed.

publish
    Publishes a Bicep module to an Azure container registry or a Bicep private registry for reuse.

restore
    Restores external modules referenced in a Bicep file by downloading them to a local cache.

uninstall
    Uninstalls the Bicep CLI from your system.

upgrade
    Upgrades the Bicep CLI to the latest available version.

version
    Displays the installed Bicep CLI version.

DESCRIPTION

The az bicep command group is an integral part of the Azure Command-Line Interface (Azure CLI), designed to facilitate interactions with Bicep files. Bicep is a declarative domain-specific language (DSL) developed by Microsoft for deploying Azure resources. It offers a more readable and concise syntax compared to traditional Azure Resource Manager (ARM) templates, simplifying Infrastructure as Code (IaC) practices.

This command group provides a comprehensive set of functionalities, including compiling Bicep files into deployable ARM templates, decompiling existing ARM templates back into Bicep for easier modification, managing Bicep CLI installations (install, upgrade, uninstall), and publishing Bicep modules to container registries for sharing and reuse. It's an indispensable tool for Azure developers and DevOps professionals, streamlining the entire lifecycle of infrastructure deployment and management through code.

CAVEATS

The command syntax is az bicep, where 'bicep' is a subcommand of the main 'az' (Azure CLI) command, not a standalone 'az-bicep' executable. This command group requires the Azure CLI to be installed and configured on your system. Some operations, particularly those involving publishing or deploying resources, may require an active Azure subscription and appropriate permissions.

BICEP MODULES

Bicep supports modularity, allowing users to encapsulate reusable infrastructure components into separate Bicep files called modules. These modules can be referenced from other Bicep files, promoting code reuse and simplifying complex deployments. The az bicep publish command is crucial for sharing these modules by publishing them to container registries, making them accessible across teams and projects.

HISTORY

Bicep was introduced by Microsoft as an open-source project to address the complexities of ARM templates, offering a more user-friendly syntax. The az bicep commands were integrated into the Azure CLI to provide native support for Bicep development. This integration has evolved significantly since Bicep's initial preview, moving towards general availability and becoming the recommended way to manage Azure infrastructure declaratively through code.

SEE ALSO

az(1), az deployment group create(1), az group create(1)

Copied to clipboard