Skip to main content

Docker

Getting Started

  1. Deploy main.bicep

Prerequisites

This is an active documentation so don't take anything from here as a the final truth.

Deploy Bicep to ARM

The main template is composed by 2 files, the template itself main.bicep and the bicep parameters file main.bicepparams, in order to compile to ARM both files need to be compiled.

Prerequisites

  • Visual Studio Code Bicep Extension Or
  • Azure CLI
  • Bicep CLI

At the moment of writing this documentation the commands related to Bicep parameters files are exclusively supported within the Bicep CLI and are not currently available in Azure CLI. These commands include: build-params.

From Microsoft documentation: When running through Azure CLI, you start the commands with az. If you're not using Azure CLI, run the commands without az at the start of the command. For example, az bicep build becomes bicep build, and az bicep version becomes bicep --version.

When you install Bicep CLI it becomes available in Azure CLI but in order to have Bicep CLI available in the command line you have to manually add the path to your environment variables. Bicep CLI should be in the directory: %USERPROFILE%\.azure\bin\ so add this path to your environment variables %USERPROFILE%\.azure\bin\bicep.exebicep.exe.

Confirm that Bicep CLI is available in the command line by running bicep --version. If you get an error make sure that the Bicep CLI is installed and that the path to it is added to the System Environment Variables.

Compile the Bicep template to ARM json file

Run in a commands window:

Azure CLI: az bicep build --file main.bicep

or

Bicep CLI: bicep build main.bicep

Microsoft Docs Reference

Compile the Bicep parameters file to Json

Run in a commands window:

Bicep CLI: bicep build-params main.bicepparam --outfile main.params.json

Note the usage of the --outfile parameter, otherwise it would override the ARM json file generated from the main.bicep template

Microsoft Docs Reference

Deploy Bicep template

  1. Open a console in this file directory.

  2. Login to your tenant az login --tenant whoiamtest.onmicrosoft.com

  3. Set the subscription az account set --subscription 61eeae14-f0f3-45bf-a1f5-38bee3eb1b89

  4. if required create a resource group az group create -l {location} -n {new-resource-group-name}

  5. deploy the resource az deployment group create -g {name-of-existing-resource-group} -f main.bicep -p storageAccountName={name-of-the-storage-account}

  6. Set a default resource group Optionally a default resource group can be set to omit the -g {name-of-existing-resource-group} section on step 4.

az configure --defaults group={name-of-existing-resource-group}