Book Image

Infrastructure as Code with Azure Bicep

By : Yaser Adel Mehraban
1 (1)
Book Image

Infrastructure as Code with Azure Bicep

1 (1)
By: Yaser Adel Mehraban

Overview of this book

It’s no secret that developers don’t like using JSON files to declare their resources in Azure because of issues such as parameter duplication and not being able to use comments in templates. Azure Bicep helps resolve these issues, and this book will guide you, as a developer or DevOps engineer, to get the most out of the Bicep language. The book takes you on a journey from understanding Azure Resource Manager (ARM) templates and what their drawbacks are to how you can use Bicep to overcome them. You will get familiar with tools such as Visual Studio Code, the Bicep extension, the Azure CLI, PowerShell, Azure DevOps, and GitHub for writing reusable, maintainable templates. After that, you’ll test the templates and deploy them to an Azure environment either from your own system or via a continuous integration and continuous delivery (CI/CD) pipeline. The book features a detailed overview of all the Bicep features, when to use what, and how to write great templates that fit well into your existing pipelines or in a new one. The chapters progress from easy to advanced topics and every effort has been put into making them easy to follow with examples, all of which are accessible via GitHub. By the end of this book, you’ll have developed a solid understanding of Azure Bicep and will be able to create, test, and deploy your resources locally or in your CI/CD pipelines.
Table of Contents (17 chapters)
1
Section 1: Getting Started with Azure Bicep
6
Section 2: Azure Bicep Core Concepts
11
Section 3: Deploying Azure Bicep Templates

Manual installation on macOS

If you want to install the Bicep CLI on macOS, you can use Homebrew, as you saw before, or via Bash scripts.

Installing Bicep via Homebrew

To install the Bicep CLI using Homebrew, simply run the following commands:

# Add the tap for bicep
brew tap azure/bicep
# Install the tool
brew install bicep

If you face any issues during installation, you can refer to the common issues on their GitHub repository at https://github.com/Azure/azure-cli/issues.

Installing Bicep via Bash

Finally, to install the Bicep CLI on macOS using Bash, you can use the following script:

# Fetch the latest Bicep CLI binary
curl -Lo bicep https://github.com/Azure/bicep/releases/latest/download/bicep-osx-x64
# Mark it as executable
chmod +x ./bicep
# Add Gatekeeper exception (requires admin)
sudo spctl --add ./bicep
# Add bicep to your PATH (requires admin)
sudo mv ./bicep /usr/local/bin/bicep
# Verify you can now access the 'bicep' command
bicep --help...