---
title: "Getting Started with Azure Bicep (Step-by-Step)"
description: "Learn how to ditch building complex ARM templates and use Azure Bicep to make building infrastructure in Azure!"
canonical: "https://adamtheautomator.com/azure-bicep/"
---

# Getting Started with Azure Bicep (Step-by-Step)

> Learn how to ditch building complex ARM templates and use Azure Bicep to make building infrastructure in Azure!

Source: https://adamtheautomator.com/azure-bicep/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![Getting Started with Azure Bicep (Step-by-Step)](https://adamtheautomator.com/wp-content/uploads/2021/10/Getting-Started-with-Azure-Bicep-Step-by-Step.jpg)

# Getting Started with Azure Bicep (Step-by-Step)

[![](https://secure.gravatar.com/avatar/75fa5f572fb085a46bfff406309882e0848db4770557901e8de897b3f7d05a7a?s=192&d=mm&r=g)Nick Rimmer](https://adamtheautomator.com/author/nick/)29 October 20216 min. read

Categories: [DevOps](/category/devops/)

Tags:[Microsoft Azure](/tag/microsoft-azure/)

Table of Contents

*   [Prerequisites](#prerequisites)
*   [What is Azure Bicep?](#what-is-azure-bicep)
*   [Setting Up a Bicep Development Environment](#setting-up-a-bicep-development-environment)
*   [Installing the VS Code Bicep Extension](#installing-the-vs-code-bicep-extension)
*   [Installing the Bicep CLI](#installing-the-bicep-cli)
*   [Creating a Bicep Template to Deploy a Storage Account](#creating-a-bicep-template-to-deploy-a-storage-account)
*   [Deploying a Bicep Template with PowerShell](#deploying-a-bicep-template-with-powershell)
*   [Deploying a Bicep Template with the Azure CLI](#deploying-a-bicep-template-with-the-azure-cli)
*   [Conclusion](#conclusion)

Do you need to build infrastructure in Azure? Have you looked at [ARM](https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/overview) templates and thought, whoa, looks complex? Because many people complained about the difficulty of building ARM templates, Microsoft developed a layer of abstraction called Azure Bicep.

In this tutorial, you will learn how to get started from scratch. You’ll learn how to do everything from setting up a development environment to deploying your first Bicep template!

Let’s get started!

## Prerequisites

This tutorial will be a hands-on demonstration. If you’d like to follow along, be sure you have the following:

*   Windows 10 – The majority of the demos in this tutorial will work on other operating systems but all demos will use Windows 10.
*   Visual Studio Code – This tutorial will use v1.60.2.

Related:[What You Need to Know about Visual Studio Code: A Tutorial](https://adamtheautomator.com/visual-studio-code-tutorial/)

*   An [Azure Resource Group](https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/manage-resource-groups-portal) to deploy to – This tutorial will use a resource group called **ATA**.

## What is Azure Bicep?

Bicep is a [domain-specific language](https://docs.microsoft.com/en-us/visualstudio/modeling/getting-started-with-domain-specific-languages?view=vs-2019) that makes building [ARM templates](https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/) easier. You can think of Bicep as an abstraction layer on top of ARM templates. ARM uses [JSON](https://www.json.org/json-en.html) and can get complex, especially for large deployments.

Microsoft decided to create Bicep to reduce the complexities and improve the development experience. It is not a new language; think of it more as an improvement to the JSON ARM templates.

## Setting Up a Bicep Development Environment

To start developing Bicep templates, you need to set up an environment that will help you get the best results. To do that, you have a few tools at your disposal. Let’s first set up the environment you need including the VS Code Bicep extension, the [Bicep CLI](https://github.com/Azure/bicep/releases/latest/download/bicep-setup-win-x64.exe), and optionally the Azure PowerShell modules.

### Installing the VS Code Bicep Extension

VS Code is a great development tool to build Bicep templates. As such, Microsoft provides a [VS Code extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-bicep) to help make creating Bicep templates easier. Let’s start building a development environment by prepping VS Code.

Related:[What You Need to Know about Visual Studio Code: A Tutorial](https://adamtheautomator.com/visual-studio-code-tutorial/)

Open Visual Studio Code and click on the **Extensions** button.

![Opening extensions](https://adamtheautomator.com/wp-content/uploads/2021/10/image-318.png)

Opening extensions

In the search bar, type “bicep”. You should see a single **Bicep** extension appear. When this happens, click on **Install.** After a few moments, VS Code will install the Bicep extension.

![Search and install bicep extension](https://adamtheautomator.com/wp-content/uploads/2021/10/image-319.png)

Search and install bicep extension

Even though the next section will give you the Bicep template to copy/paste, you’ll undoubtedly have times when you need to create Bicep templates from scratch. The Bicep extension in VS Code comes in handy here particularly due to its [Intellisense features](https://code.visualstudio.com/docs/editor/intellisense#:~:text=IntelliSense%20is%20a%20general%20term,%2C%20and%20%22code%20hinting.%22).

Notice that if you open a file with an extension of _.bicep_ in VS Code, VS Code will attempt to provide shortcuts for you. For example, you create Azure resources with the `resource` keyword in a Bicep template. With the Bicep extension installed, VS Code understands this.

![Typing the resource command](https://adamtheautomator.com/wp-content/uploads/2021/10/image-320.png)

Typing the resource command

Selecting one of the provided menu options then automatically creates a template to fill out rather than having to remember the exact syntax every time.

![ Blank bicep template ](https://adamtheautomator.com/wp-content/uploads/2021/10/image-321.png)

Blank bicep template

The period (`.`) is another handy shortcut when creating Bicep templates. By typing this in the **properties** section, for example, you’ll see all the properties available for a storage account.

![Properties available for a storage account](https://adamtheautomator.com/wp-content/uploads/2021/10/image-322.png)

Properties available for a storage account

### Installing the Bicep CLI

Once created, you must invoke Bicep templates via the Bicep CLI. Before attempting to install the Bicep CLI, first check to see if it’s already installed. Depending on the version of the Azure CLI you have installed, you may already have the Bicep CLI. To check, open a PowerShell console or terminal and check for the version of the Bicep CLI.

```bash
	az bicep version
```

If you have the Bicep CLI installed, you’ll see a version statement, as shown below.

![Bicep CLI version](https://adamtheautomator.com/wp-content/uploads/2021/10/image-323.png)

Bicep CLI version

If you see an error message about the Bicep CLI not being found, run the `install` subcommand to install the Bicep CLI.

```bash
az bicep install
```

You will now see the output as below. It confirms that the Bicep CLI has been successfully installed and is ready for use.

![Bicep installed successfully](https://adamtheautomator.com/wp-content/uploads/2021/10/image-324.png)

Bicep installed successfully

> _As an alternate installation method, you can also install the Bicep CLI via the [Bicep Windows Installer](https://github.com/Azure/bicep/releases/latest/download/bicep-setup-win-x64.exe)._

## Creating a Bicep Template to Deploy a Storage Account

You can deploy some complex Azure resources with Bicep but let’s start off slow. For your first Bicep template, let’s create a simple Azure storage account that you can then use to deploy to Azure using both the Azure CLI and PowerShell in the next section.

1\. Open VS Code and create a new file called main. bicep. You don’t have to name the file exactly as shown here but following Terraform’s lead calling the template _main_ with a _.bicep_ extension is common.

2\. Copy and paste the Bicep template below code below into the file and save it. This template contains various attributes that make up a Bicep template.

You’ll first see some attributes common to all Bicep templates:

*   The resource identifier (`resource myStorage`) – Tells Bicep to create a new resource named `myStorage`. This name identifies the particular resource within the Bicep template. This name is not the name of the resource that is created in Azure.
*   `Microsoft.Storage/storageAccounts@2019-06-01`– Defines a type composed of the resource provider `Microsoft.Storage`, the resource type (`storageAccounts`), and the API version `(2019-06-01)` to use.
*   **`name` –** The name of the resource as it appears in Azure (pay attention to the [rules and restrictions](https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/resource-name-rules) for naming Azure resources.)
*   `location` – The Azure region to create the resource in.

You’ll also see some attributes specific to the `storageAccounts` resource type:

*   `SKU` – The storage account SKU (**[`Standard_LRS`](https://docs.microsoft.com/en-us/rest/api/storagerp/srp_sku_types))** as defined in the property `name`.
*   `kind` – The type of storage account ([StorageV2](https://docs.microsoft.com/en-us/azure/storage/common/storage-account-overview)).
*   `properties` **–** Various resource-specific properties that don’t have their own section such as `accessTier` in this example. These properties are the same as you’ll find in [ARM templates](https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/syntax).

```bash
resource myStorage 'Microsoft.Storage/storageAccounts@2019-06-01' = {
  name: 'ata2021bicepdiskstorage'
  location: 'uksouth'
  SKU: {
    name: 'Standard_LRS'
  }
  kind: 'StorageV2'
  properties: {
    accessTier: 'Hot'
        
  }
}
```

## Deploying a Bicep Template with PowerShell

As mentioned earlier, you can deploy Bicep templates one of two ways; via the Azure CLI and Azure PowerShell module. Let’s first deploy a Bicep template with PowerShell.

> _Be sure you have the [Azure PowerShell module](https://docs.microsoft.com/en-us/powershell/azure/azurerm/install-azurerm-ps?view=azurermps-6.13.0) installed and you are [authenticated to Azure](https://adamtheautomator.com/connect-azaccount/) before starting this section._

Deploying Azure resources with Bicep templates is identical to deploying ARM templates. Microsoft has essentially added support for the Bicep language to many of the existing PowerShell ARM cmdlets such as `[New-AzResourceGroupDeployment](https://docs.microsoft.com/en-us/powershell/module/az.resources/new-azresourcegroupdeployment?view=azps-6.5.0).`

In your PowerShell console, invoke a new resource group deployment via the `New-AzResourceGroupDeployment` cmdlet providing the path of the Bicep template and the `ResourceGroupName` to deploy to. You’ll notice that you can use a Bicep template exactly how you could an ARM template.

```bash
New-AzResourceGroupDeployment -TemplateFile main.bicep -ResourceGroupName ATA
```

If the deployment is successful, you should see the following output in your PowerShell session with the property **ProvisioningState** showing as successful. That’s it!

![Deploying resource with Bicep](https://adamtheautomator.com/wp-content/uploads/2021/10/image-325.png)

Deploying resource with Bicep

To verify the resource was created successfully, log into the [Azure Portal](https://azure.microsoft.com/en-gb/account/), navigate to your resource group, and you will see inside that resource group a newly created storage account.

![Azure Portal](https://adamtheautomator.com/wp-content/uploads/2021/10/image-326.png)

Azure Portal

If you’re following along and created the storage account as a demo, don’t forget to remove it! Notice the `ResourceName` coincides with the `name` provided in the Bicep template.

```bash
Remove-AzResource -ResourceName ata2021bicepdiskstorage -ResourceGroupName ATA -ResourceType "Microsoft.Storage/storageAccounts"
```

You will now see the following output.

![Removing an Azure storage account](https://adamtheautomator.com/wp-content/uploads/2021/10/image-327.png)

Removing an Azure storage account

## Deploying a Bicep Template with the Azure CLI

To round out this tutorial, let’s now cover deploying your recently-built Bicep template with the Azure CLI.

> _Be sure you have [Azure CLI](https://adamtheautomator.com/install-azure-cli/) v2.2.0+ installed and [signed in](https://docs.microsoft.com/en-us/cli/azure/authenticate-azure-cli) before starting this section._

With your PowerShell or another terminal open, invoke an ARM deployment with the [`az deployment group create` command](https://docs.microsoft.com/en-us/cli/azure/deployment/group?view=azure-cli-latest). This command performs an ARM deployment just like with PowerShell. Be sure to specify the `resource-group` to deploy to along with the Bicep template created earlier via the `template-file` parameter.

```bash
az deployment group create --resource-group ATA --template-file main.bicep
```

If you see the **provisioningState** as **Succeeded**, as shown below, ARM has read the Bicep template and carried out all of the instructions within!

![provisioningState as Succeeded](https://adamtheautomator.com/wp-content/uploads/2021/10/image-329.png)

**provisioningState** as **Succeeded**

![Output in JSON from az deployment command](https://adamtheautomator.com/wp-content/uploads/2021/10/image-328.png)

**Output in JSON from az deployment command**

> _Don’t forget to clean up the resource with `az resource delete -g ATA -n ata2021bicepdiskstorage --resource-type "Microsoft.Storage/storageAccounts"`_

### Conclusion

Now you have created a development environment for Azure Bicep and created a resource in Azure, what is your next step? Perhaps look at what [Microsoft Learn](https://docs.microsoft.com/en-us/learn/paths/fundamentals-bicep/) has to offer on Bicep?

Perhaps a demonstration to your colleagues on how Bicep can help your organization?

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Fazure-bicep%2F&text=Getting%20Started%20with%20Azure%20Bicep%20\(Step-by-Step\))[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Fazure-bicep%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Fazure-bicep%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2023/10/automating-azure-resource.jpg)

### [Automating Azure Resource Deployments in PowerShell: Part 1](/automating-azure-resource/)

Learn the many ways to get started with automating Azure resource deployments in part one of this three part series.

![](https://adamtheautomator.com/wp-content/uploads/2023/02/create-an-azure-vm.jpg)

### [Discover How to Create an Azure VM in Microsoft Azure Cloud](/create-an-azure-vm/)

Learn the many ways how to create an Azure VM in the Microsoft Azure Cloud and move your resources and processes into the cloud!

![](https://adamtheautomator.com/wp-content/uploads/2022/11/azure-kubernetes-service.jpg)

### [Getting Started with the Azure Kubernetes Service (AKS)](/azure-kubernetes-service/)

Learn how to leverage Microsoft Azure Kubernetes Service (AKS) and take your DevOps infrastructure to the next level!

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
