Coder Perfect

Using bicep to deploy resources

Problem

We’re trying to deploy resources on Azure and are utilizing Microsoft’s Bicep for this.

Visual studio code insider is being used to execute the code.

Note This is an example of what I’m talking about.

The following is the code:

    resource stg 'Microsoft.Storage/storageAccounts@2019-06-01' = {
  name: 'uniquestorage001' // must be globally unique
  location: 'eastus'
  kind: 'Storage'
  sku: {
    name: 'Standard_LRS'
  }
}

To build it, we execute the following command in the terminal.

bicep build main.bicep

The error message that I receive is as follows:

bicep: The term 'bicep' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again

The bicep extension has been placed.

I’m not sure what else I can do, so please assist me.

Asked by sudlo

Solution #1

To install bicep, follow these instructions: Bicep tools should be installed.

You must first install Azure CLI before you can install bicep:

az bicep install

You can then use the following to create your bicep file:

az bicep build --file main.bicep

You also don’t have to construct your bicep file before deploying it; the AZ CLI allows you to launch your bicep file straight.

az deployment group create --resource-group "my resource group name" --template-file ".\main.bicep"

Answered by Thomas

Post is based on https://stackoverflow.com/questions/69283369/deploying-resources-using-bicep