What is Bicep?

Bicep is a domain-specific language that uses declarative syntax to deploy Azure resources. In a Bicep file, you define the infrastructure you want to deploy to Azure and then use that file throughout the development lifecycle to repeatedly deploy that infrastructure. Your resources are deployed in a consistent manner.

Bicep provides concise syntax, reliable type safety, and support for reusing code. Bicep offers a first-class authoring experience for your infrastructure-as-code solutions in Azure.

Benefits of Bicep

Bicep provides the following advantages:

  • Support for all resource types and API versions: Bicep immediately supports all preview and GA versions for Azure services. As soon as a resource provider introduces new resource types and API versions, you can use them in your Bicep file. You don't need to wait for tools to be updated before using the new services.

  • Simple syntax: When compared to the equivalent JSON template, Bicep files are more concise and easier to read. Bicep doesn't require prior knowledge of programming languages. Bicep syntax is declarative and specifies which resources and resource properties you want to deploy.

    The following examples show the difference between a Bicep file and the equivalent JSON template. Both examples deploy a storage account:

    param location string = resourceGroup().location
    param storageAccountName string = 'toylaunch${uniqueString(resourceGroup().id)}'
    
    resource storageAccount 'Microsoft.Storage/storageAccounts@2023-05-01' = {
      name: storageAccountName
      location: location
      sku: {
        name: 'Standard_LRS'
      }
      kind: 'StorageV2'
      properties: {
        accessTier: 'Hot'
      }
    }
    

  • Authoring experience: When you use the Bicep Extension for VS Code to create your Bicep files, you get a first-class authoring experience. The editor provides rich type-safety, IntelliSense, and syntax validation.

    A screen capture of authoring a Bicep file in real time

    You can also create Bicep files in Visual Studio with the Bicep extension for Visual Studio.

  • Repeatable results: Repeatedly deploy your infrastructure throughout the development lifecycle and have confidence that your resources are deployed in a consistent manner. Bicep files are idempotent, which means that you can deploy the same file many times and get the same resource types in the same state. You can develop one file that represents the desired state instead of developing many separate files to represent updates. For example, the following file creates a storage account. If you deploy this template and the storage account when the specified properties already exist, changes aren't made:

    param location string = resourceGroup().location
    
    resource mystore 'Microsoft.Storage/storageAccounts@2023-05-01' = {
      name: 'mystorageaccount'
      location: location
      sku: {
        name: 'Standard_LRS'
      }
      kind: 'StorageV2'
    }
    

  • Orchestration: You don't have to worry about the complexities of ordering operations. Resource Manager orchestrates the deployment of interdependent resources so that they're created in the correct order. When possible, Resource Manager deploys resources in parallel, which helps your deployments to finish faster than serial deployments. You deploy the file through one rather than multiple imperative commands.

    A diagram comparing deployment between a Bicep file and infrastructure as code not in a template.

  • Modularity: You can use modules to segment your Bicep code into manageable parts. Modules help you to reuse code and simplify development. A module deploys a set of related resources. Add a module to a Bicep file any time you need to deploy those resources.

  • Integration with Azure services: Bicep integrates with Azure services such as Azure Policy, template specs, and Azure Blueprints.

  • Preview changes: You can use the what-if operation to preview changes before deploying the Bicep file. The what-if operation shows you which resources will be created, updated, or deleted and any resource properties that'll be changed. It also checks the current state of your environment and eliminates the need to manage this state.

  • No state or state files to manage: All state is stored in Azure. Users can collaborate and be confident that their updates are handled as expected.

  • No cost and open source: Since Bicep is completely free, you don't have to pay for premium capabilities. It's also supported by Microsoft Support.

Get started

To start with Bicep:

  1. Install the tools. See Set up Bicep development and deployment environments or use the VS Code devcontainer/Codespaces repository to get a pre-configured authoring environment.
  2. Complete the Quickstart and Learn modules for Bicep.

To decompile an existing Resource Manager template to Bicep, see Decompiling ARM template JSON to Bicep. You can use Bicep Playground to view Bicep and its equivalent, JSON, side by side.

To learn about the resources that are available in your Bicep file, see Bicep resource reference.

Bicep examples can be found in the Bicep GitHub repo.

About the language

Bicep isn't intended as a general programming language to write applications. A Bicep file declares Azure resources and resource properties without writing a sequence of programming commands to create them.

To track the status of the Bicep work, see the Bicep project repository.

Watch the following video to learn about Bicep:

You can use Bicep instead of JSON to develop Resource Manager templates. The JSON syntax to create a Resource Manager template can be verbose and require complicated expressions. Bicep syntax reduces that complexity and improves the development experience. Bicep is a transparent abstraction over a Resource Manager JSON template that doesn't lose the capabilities of a JSON template. During deployment, the Bicep CLI converts a Bicep file into a Resource Manager JSON template.

Resource types, API versions, and properties that are valid in a Resource Manager template are valid in a Bicep file.

Bicep offers an easier and more concise syntax when compared to its equivalent, JSON. You don't use bracketed expressions [...]. Instead, you directly call functions and get values from parameters and variables. You give each deployed resource a symbolic name, which makes it easy to reference that resource in your template.

For a full comparison of the syntax, see Comparing JSON and Bicep for templates.

Bicep automatically manages dependencies between resources. You can avoid setting dependsOn when the symbolic name of a resource is used in another resource declaration.

The structure of the Bicep file is more flexible than a JSON template. You can declare parameters, variables, and outputs anywhere in the file. In JSON, you have to declare all parameters, variables, and outputs within the corresponding sections of the template.

Get support

Here are the steps for opening a support ticket for Azure Resource Manager (ARM) template related issues:

  1. Open the Azure portal.

  2. Select the Support + Troubleshooting icon from the upper right corner.

  3. In Briefly describe the issue, enter ARM template, and then select Go.

  4. In Which service are you having an issue with?, select Portal under Monitoring & Management, and then select Next.

  5. Select a subscription, and then select Next.

  6. Select Issue with ARM templates, and then select Next.

    Screenshot of requesting ARM template support.

Next steps

Get started with the Quickstart.

For answers to common questions, see Frequently asked questions for Bicep.