Create Bicep files by using Visual Studio Code

This article shows you how to use Visual Studio Code to create Bicep files.

Install VS Code

To set up your environment for Bicep development, see Install Bicep tools. After completing those steps, you'll have Visual Studio Code and the Bicep extension. You also have either the latest Azure CLI or the latest Azure PowerShell module.

Bicep commands

Visual Studio Code comes with several Bicep commands.

Open or create a Bicep file in VS Code, select the View menu and then select Command Palette. You can also use the key combination [CTRL]+[SHIFT]+P to bring up the command palette. Type Bicep to list the Bicep commands.

Screenshot of Visual Studio Code Bicep commands in the command palette.

These commands include:

These commands are also shown in the context menu when you right-click a Bicep file:

Screenshot of Visual Studio Code Bicep commands in the context menu for Bicep files.

When you right-click a JSON file:

Screenshot of Visual Studio Code Bicep commands in the context menu for ARM JSON templates.

Build ARM template

The build command converts a Bicep file to an Azure Resource Manager template (ARM template). The new JSON template is stored in the same folder with the same file name. If a file with the same file name exists, it overwrites the old file. For more information, see Bicep CLI commands.

Create Bicep configuration file

The Bicep configuration file (bicepconfig.json) can be used to customize your Bicep development experience. You can add bicepconfig.json in multiple directories. The configuration file closest to the bicep file in the directory hierarchy is used. When you select this command, the extension opens a dialog for you to select a folder. The default folder is where you store the Bicep file. If a bicepconfig.json file already exists in the folder, you can overwrite the existing file.

To create a Bicep configuration file:

  1. Open Visual Studio Code.
  2. From the View menu, select Command Palette (or press [CTRL/CMD]+[SHIFT]+P), and then select Bicep: Create Bicep Configuration File.
  3. Select the file directory where you want to place the file.
  4. Save the configuration file when you're done.

Decompile into Bicep

This command decompiles an ARM JSON template into a Bicep file, and places it in the same directory as the ARM JSON template. The new file has the same file name with the .bicep extension. If a Bicep file with the same file name already exists in the same folder, Visual Studio Code prompts you to overwrite the existing file or create a copy.

Deploy Bicep file

You can deploy Bicep files directly from Visual Studio Code. Select Deploy Bicep file from the command palette or from the context menu. The extension prompts you to sign in Azure, select subscription, create/select resource group, and enter parameter values.

Generate parameters file

This command creates a parameter file in the same folder as the Bicep file. The new parameter file name is <bicep-file-name>.parameters.json.

Insert resource

The insert resource command adds a resource declaration in the Bicep file by providing the resource ID of an existing resource. After you select Insert Resource, enter the resource ID in the command palette. It takes a few moments to insert the resource.

You can find the resource ID by using one of these methods:


Similar to exporting templates, the process tries to create a usable resource. However, most of the inserted resources require some modification before they can be used to deploy Azure resources.

For more information, see Decompiling ARM template JSON to Bicep.

Open Bicep visualizer

The visualizer shows the resources defined in the Bicep file with the resource dependency information. The diagram is the visualization of a Linux virtual machine Bicep file.

Visual Studio Code Bicep visualizer

You can also open the visualizer side-by-side with the Bicep file.

Restore Bicep modules

When your Bicep file uses modules that are published to a registry, the restore command gets copies of all the required modules from the registry. It stores those copies in a local cache. For more information, see restore.

View type document

From Visual Studio Code, you can easily open the template reference for the resource type you're working on. To do so, hover your cursor over the resource symbolic name, and then select View type document.

Screenshot of Visual Studio Code Bicep view type document.

Next steps

To walk through a quickstart, see Quickstart: Create Bicep files with Visual Studio Code.