How to Deploy a Bicep Template

This blog post will show you how to deploy a Bicep template to Microsoft Azure using Azure CLI.

Deploying a Bicep template to Microsoft Azure is a two steps process. First, we need to create a Bicep template in VS Code. Once the template is ready, we need to deploy it to Azure.

To deploy a template to Azure, we need to follow the steps below:

  • Have Azure CLI or Azure PowerShell installed
  • Login to Azure
  • Deploy template

The steps below will go over each of the above steps.

Note: Microsoft recommends using Az CLI and not PowerShell for Bicep deployment.

Install Azure CLI (Linux)

The first step is to install Azure CLI using the following command. In my case, I’m using it on a Linux machine.

curl -sL | sudo bash

Login to Azure Using Azure CLI

After installing Azure CLI, we need to log in to Azure and authenticate with a user with enough permissions to create resources on Azure.

az login

If you have more than one Azure subscription, you can set your subscription using the below command. If you have one subscription, there is no need to run it.

az account set --subscription SUBNAME

Deploy Template

The final step is to deploy the template. You run the deployment using the command below. Make sure you set the deployment name, resource group and .Bicep file path.

az deployment group create  --name DEPLOYMENTNAME--template-file  NAAME.bicep   --resource-group group RGNAME


To update your Azure CLI modules, you can use the following command.

az upgrade  # update Az CLI

Set up Azure CLI to auto-update itself and not worry about updating it using the command below (recommended).

az config set auto-upgrade.enable=yes

About Azure Bicep

The Resource Manager template language Azure Bicep enables you to deploy Azure resources declaratively. It’s a domain-specific language, which implies it was created specifically to deploy Azure resources. Bicep is only used to create Resource Manager templates.

Bicep is designed to be simple to understand and learn, regardless of your prior experience with other programming languages. Bicep templates can use all resource types, API versions, and property values.