Saturday, 8 May 2021

Azure Infrastructure as Code (IaC) with Bicep - Setup Development Environment

 Bicep is the latest infrastructure as code solution released by Microsoft to develop and deploy resources to Azure cloud. Bicep is built on top of Azure resource manager templates (ARM) simplifying the development by introducing a declarative syntax to define infrastructure resources. Bicep converts into ARM templates JSON before execution. Let’s begin with setting up a development environment for Bicep.

You need to have Visual Studio Code installed in your machine to as a prerequisite. To enable syntax and development support for Bicep to Visual Studio Code, we need to install Bicep extension in VS Code.



If you want to use your development machine to deploy the resources to Azure via Bicep you need to install couple of more tools.

Install Azure CLI to your machine. You can check the version installed by executing below command.

az --version

Then install Bicep using command below.

az bicep install


You can execute az bicep upgrade to upgrade bicep to latest version. To check the version of bicep run az bicep version.

However, if you try to run bicep commands without az you will get command not found error in PowerShell. 

This is due to Azure CLI based Bicep instance is self-contained and it is not added to path of your system.

You can manually install Bicep instance to you machine using installers available for each OS. Windows installer can be found here. To install Bicep CLI manually you need Azure PowerShell 5.6 or later running in your machine. To install Azure PowerShell you can execute command below.

Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force -AllowClobber


Download Bicep installer and run it. Follow the steps in the wizard and install. Run bicep --version in a PowerShell window and you would be able to see the installed version.

Now we are fully ready with our development machine to develop and deploy Azure resources via Bicep. Let's discuss the steps in a next post.
  









No comments:

Popular Posts