Introduction to Azure Bicep – DEV Community

Azure Bicep

Azure Bicep is a brand new Area-Particular Language (DSL) for declaratively deploying Azure assets. Bicep shouldn’t be a common objective programming language however a clear abstraction for Azure Useful resource Supervisor (ARM) Templates. This ensures that the properties which are legitimate in ARM templates are legitimate in Bicep as properly.

Advantages of Bicep

Bicep supplies the next benefits:

  1. Assist for all useful resource sorts and API variations
  2. Easy syntax
  3. Authoring expertise
  4. Repeatable outcomes
  5. Orchestration
  6. Modularity
  7. Integration with Azure companies
  8. Preview modifications
  9. No state or state information to handle
  10. No price and open supply

Why Bicep?

ARM templates are JSON paperwork that supply a declarative method of defining our Azure infrastructure and configuration. ARM template language provides built-in capabilities and different language constructs resembling loops and that assist us to create extra dynamic infrastructure definitions.

Nonetheless, the JSON syntax for ARM templates makes the paperwork fairly verbose and restricts the extensibility since now we have to play what’s supported inside JSON knowledge illustration.

Because the complexity of the infrastructure grows, our ARM template turns into virtually unreadable and tough to take care of as properly. There are options to ARM template deployment. Particularly, HashiCorp Terraform or Pulumi SDK. These instruments don’t use ARM templates however present alternate methods to outline our infrastructure as code.

The next examples present the distinction between a Bicep file and the equal JSON template. Each examples deploy a storage account.

param storageAccountName string
param accessTier string = 'Sizzling'
param location string = 'WestUS2'

useful resource sa 'Microsoft.Storage/storageAccounts@2019-06-01' = {
  identify: storageAccountName
  location: location
  sku: {
    identify: 'Standard_LRS'
  sort: 'StorageV2'
  properties: {
    accessTier: accessTier
Enter fullscreen mode

Exit fullscreen mode

The 26 strains within the above instance is what you might want to create a reusable Bicep file that may generate ARM template to provision an Azure storage account. This, when compiled, produces the next ARM template.

  "$schema": "",
  "contentVersion": "",
  "parameters": {
    "storageAccountName": {
      "sort": "string"
    "accessTier": {
      "sort": "string",
      "defaultValue": "Sizzling"
    "location": {
      "sort": "string",
      "defaultValue": "WestUS2"
  "capabilities": [],
  "assets": [
      "type": "Microsoft.Storage/storageAccounts",
      "apiVersion": "2019-06-01",
      "name": "[parameters('storageAccountName')]",
      "location": "[parameters('location')]",
      "sku": {
        "identify": "Standard_LRS"
      "sort": "StorageV2",
      "properties": {
        "accessTier": "Sizzling"
  "metadata": {
    "_generator": {
      "identify": "bicep",
      "model": "",
      "templateHash": "6796585337478950038"
Enter fullscreen mode

Exit fullscreen mode

The generated template is nearly twice the dimensions of the Bicep file. This ARM template may be deployed by supplying the required parameter values as one other JSON or on the command line when utilizing Azure CLI or Azure PowerShell.

This can be a instance the place it exhibits the flexibleness that we’re having with this language of its personal to generate the ARM templates. Bicep supplies not simply the constructs of a typical programming language but additionally a method to compose our Azure infrastructure definitions as smaller reusable modules.

Thanks for studying my article until finish. I hope you discovered one thing particular in the present day. In case you loved this text then please share to your pals and when you’ve got solutions or ideas to share with me then please write within the remark field.

Add a Comment

Your email address will not be published. Required fields are marked *