Home Page Icon
Home Page
Table of Contents for
Infrastructure as Code with Azure Bicep
Close
Infrastructure as Code with Azure Bicep
by Yaser Adel Mehraban, John Downs, Edmondo Rosini
Infrastructure as Code with Azure Bicep
Infrastructure as Code with Azure Bicep
Foreword
Contributors
About the author
About the reviewer
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Conventions used
Get in touch
Share Your Thoughts
Section 1: Getting Started with Azure Bicep
Chapter 1: An Introduction to Azure Bicep
Technical requirements
What is Azure Bicep?
IaC
ARM templates
Azure Bicep
Why was it created?
Why create a new revision?
What about current third-party tools?
How does it work?
Authoring experience
What happens to my ARM templates?
Bicep CLI
Summary
Chapter 2: Installing Azure Bicep
Technical requirements
Cross-platform installation
Installing the Azure CLI
Installing Bicep using the Azure CLI
Installing Bicep using Azure PowerShell
Installation on Windows
Installation using Windows Installer
Installation using Chocolatey
Installation using winget
Manual installation using PowerShell
Manual installation on macOS
Installing Bicep via Homebrew
Installing Bicep via Bash
Manual installation on Linux
Getting nightly builds
Working with Bicep in a Docker container
Working with an Azure CLI Docker container
Summary
Chapter 3: Authoring Experience
Technical requirements
Bicep extension for Visual Studio Code
Installing Visual Studio Code
Installing the Bicep extension
Snippets offered by the Bicep extension
Refactoring
Formatting
Using quick fixes
Configuring the Bicep linter
Customizing the linter
Using the Bicep CLI to use the linter
Bicep Playground
Compiling Bicep snippets
Decompiling an ARM template
Using sample templates in Bicep Playground
Summary
Chapter 4: Compiling and Decompiling Bicep Files
Technical requirements
Compiling Bicep files
Compiling a Bicep file using the Bicep CLI
Compiling and deploying a Bicep file using the Azure CLI
Compiling and deploying a Bicep file using Azure PowerShell
Troubleshooting possible errors and warnings
An invalid template
Linter errors
Decompiling ARM templates into Bicep
Using the Azure CLI
Using the Bicep CLI
Potential fixes after decompiling
Exporting templates and decompiling
Summary
Section 2: Azure Bicep Core Concepts
Chapter 5: Defining Resources
Technical requirements
Resource definition
Common properties
Resource-specific properties
Adding additional properties
Referencing existing resources
Referencing a resource that is in the same file
Referencing an already deployed resource
Explicit dependencies
Visualizing dependencies
Resource scopes
Resource group
Subscription
Management group
Tenant
Setting the scope at the resource level
Multi-scope Bicep files
Global functions
Bicep language specification
Structure
Whitespaces
Comments
Bicep type system
Supported data types
Simple types
Objects
Arrays
Union types
ARM and Bicep syntax comparison
Best practices for Bicep syntax
Summary
Chapter 6: Using Parameters, Variables, and Template Functions
Technical requirements
Parameters
Minimalistic definition
Setting default values
Using decorators
Using parameters within a Bicep template
Passing parameters during deployment
Variables
Defining variables
Using variables
Configuration variables
Template functions
The any function
Date functions
The bool function
Deployment functions
Numeric functions
Array functions
Object functions
Resource functions
String functions
Summary
Chapter 7: Understanding Expressions, Symbolic Names, Conditions, and Loops
Technical requirements
Understanding expressions
Unary operators
Comparison operators
Logical operators
Numeric operators
Accessor operators
Operator precedence and associativity
Exploring conditions
Deploy condition
New or existing resource
Runtime checks
Diving into resource iterations
Syntax
Loop index
Loop array
Loop array and index
Nested loops with conditions
Using batches
Summary
Chapter 8: Defining Modules and Utilizing Outputs
Technical requirements
Modules
Defining modules
Consuming a module
Additional considerations
Defining and configuring module scopes
Using Bicep outputs
Defining outputs
Conditional outputs
Returning multiple outputs with loops
Module outputs
Getting output values after deployment
Summary
Section 3: Deploying Azure Bicep Templates
Chapter 9: Deploying a Local Template
Technical requirements
Deploying Bicep with Azure PowerShell
Connecting to your Azure environment
Previewing changes with the what-if operation
Passing parameters
Deployment scopes
Deploying Bicep with the Azure CLI
Connecting to your Azure environment
Preview changes with what-if operation
Passing parameters
Deployment scopes
Troubleshooting possible errors and warnings
Compile-time errors and warnings
Deployment-time errors
Summary
Chapter 10: Deploying Bicep Using Azure DevOps
Technical requirements
Creating the Azure DevOps pipeline
Prerequisites
Creating a pipeline in Azure DevOps
Adding a validation step to our pipeline
Validating the deployment
Deploying the template
Adding the deployment step
Pushing the changes to your repository
Accessing the deployment output in the pipeline
Receiving outputs from a deployment
An alternative approach to accessing deployment outputs
Summary
Chapter 11: Deploying Bicep Templates Using GitHub Actions
Technical requirements
Creating a GitHub action
Prerequisites
Creating the workflow from code
Adding validation steps to the workflow
Adding an Azure CLI action to the workflow
Adding deployment steps to the workflow
Using the official Azure ARM action
Adding the Azure ARM action to the workflow
Accessing deployment outputs for later use
Accessing outputs from the Azure CLI action
Accessing outputs from the Azure ARM action
Summary
Chapter 12: Exploring Best Practices for Future Maintenance
Technical requirements
Applying version control and code flows for your IaC
Single pipeline approach
Separate pipelines for code and infrastructure
Source control everything
Idempotency and its importance
Idempotency
Immutability
Modularity and microservices
Bicep best practices
Parameters
Variables
Resource definitions
Outputs
Configuration set
Shared variable file
Managing service version updates
Azure Bicep's known limitations
Single-line objects and arrays
Newline sensitivity
No support for API profiles
CLI limitations
Summary
Why subscribe?
Other Books You May Enjoy
Packt is searching for authors like you
Share Your Thoughts
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Infrastructure as Code with Azure Bicep
Next
Next Chapter
Preface
Table of Contents
Preface
Section 1: Getting Started with Azure Bicep
Chapter 1
: An Introduction to Azure Bicep
Technical requirements
What is Azure Bicep?
IaC
ARM templates
Azure Bicep
Why was it created?
Why create a new revision?
What about current third-party tools?
How does it work?
Authoring experience
What happens to my ARM templates?
Bicep CLI
Summary
Chapter 2
: Installing Azure Bicep
Technical requirements
Cross-platform installation
Installing the Azure CLI
Installing Bicep using the Azure CLI
Installing Bicep using Azure PowerShell
Installation on Windows
Installation using Windows Installer
Installation using Chocolatey
Installation using winget
Manual installation using PowerShell
Manual installation on macOS
Installing Bicep via Homebrew
Installing Bicep via Bash
Manual installation on Linux
Getting nightly builds
Working with Bicep in a Docker container
Working with an Azure CLI Docker container
Summary
Chapter 3
: Authoring Experience
Technical requirements
Bicep extension for Visual Studio Code
Installing Visual Studio Code
Installing the Bicep extension
Snippets offered by the Bicep extension
Refactoring
Formatting
Using quick fixes
Configuring the Bicep linter
Customizing the linter
Using the Bicep CLI to use the linter
Bicep Playground
Compiling Bicep snippets
Decompiling an ARM template
Using sample templates in Bicep Playground
Summary
Chapter 4
: Compiling and Decompiling Bicep Files
Technical requirements
Compiling Bicep files
Compiling a Bicep file using the Bicep CLI
Compiling and deploying a Bicep file using the Azure CLI
Compiling and deploying a Bicep file using Azure PowerShell
Troubleshooting possible errors and warnings
An invalid template
Linter errors
Decompiling ARM templates into Bicep
Using the Azure CLI
Using the Bicep CLI
Potential fixes after decompiling
Exporting templates and decompiling
Summary
Section 2: Azure Bicep Core Concepts
Chapter 5
: Defining Resources
Technical requirements
Resource definition
Common properties
Resource-specific properties
Adding additional properties
Referencing existing resources
Referencing a resource that is in the same file
Referencing an already deployed resource
Explicit dependencies
Visualizing dependencies
Resource scopes
Resource group
Subscription
Management group
Tenant
Setting the scope at the resource level
Multi-scope Bicep files
Global functions
Bicep language specification
Structure
Whitespaces
Comments
Bicep type system
Supported data types
Simple types
Objects
Arrays
Union types
ARM and Bicep syntax comparison
Best practices for Bicep syntax
Summary
Chapter 6
: Using Parameters, Variables, and Template Functions
Technical requirements
Parameters
Minimalistic definition
Setting default values
Using decorators
Using parameters within a Bicep template
Passing parameters during deployment
Variables
Defining variables
Using variables
Configuration variables
Template functions
The any function
Date functions
The bool function
Deployment functions
Numeric functions
Array functions
Object functions
Resource functions
String functions
Summary
Chapter 7
: Understanding Expressions, Symbolic Names, Conditions, and Loops
Technical requirements
Understanding expressions
Unary operators
Comparison operators
Logical operators
Numeric operators
Accessor operators
Operator precedence and associativity
Exploring conditions
Deploy condition
New or existing resource
Runtime checks
Diving into resource iterations
Syntax
Loop index
Loop array
Loop array and index
Nested loops with conditions
Using batches
Summary
Chapter 8
: Defining Modules and Utilizing Outputs
Technical requirements
Modules
Defining modules
Consuming a module
Additional considerations
Defining and configuring module scopes
Using Bicep outputs
Defining outputs
Conditional outputs
Returning multiple outputs with loops
Module outputs
Getting output values after deployment
Summary
Section 3: Deploying Azure Bicep Templates
Chapter 9
: Deploying a Local Template
Technical requirements
Deploying Bicep with Azure PowerShell
Connecting to your Azure environment
Previewing changes with the what-if operation
Passing parameters
Deployment scopes
Deploying Bicep with the Azure CLI
Connecting to your Azure environment
Preview changes with what-if operation
Passing parameters
Deployment scopes
Troubleshooting possible errors and warnings
Compile-time errors and warnings
Deployment-time errors
Summary
Chapter 10
: Deploying Bicep Using Azure DevOps
Technical requirements
Creating the Azure DevOps pipeline
Prerequisites
Creating a pipeline in Azure DevOps
Adding a validation step to our pipeline
Validating the deployment
Deploying the template
Adding the deployment step
Pushing the changes to your repository
Accessing the deployment output in the pipeline
Receiving outputs from a deployment
An alternative approach to accessing deployment outputs
Summary
Chapter 11
: Deploying Bicep Templates Using GitHub Actions
Technical requirements
Creating a GitHub action
Prerequisites
Creating the workflow from code
Adding validation steps to the workflow
Adding an Azure CLI action to the workflow
Adding deployment steps to the workflow
Using the official Azure ARM action
Adding the Azure ARM action to the workflow
Accessing deployment outputs for later use
Accessing outputs from the Azure CLI action
Accessing outputs from the Azure ARM action
Summary
Chapter 12
: Exploring Best Practices for Future Maintenance
Technical requirements
Applying version control and code flows for your IaC
Single pipeline approach
Separate pipelines for code and infrastructure
Source control everything
Idempotency and its importance
Idempotency
Immutability
Modularity and microservices
Bicep best practices
Parameters
Variables
Resource definitions
Outputs
Configuration set
Shared variable file
Managing service version updates
Azure Bicep's known limitations
Single-line objects and arrays
Newline sensitivity
No support for API profiles
CLI limitations
Summary
Other Books You May Enjoy
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset