contents

  

Front matter

foreword

preface

acknowledgments

about this book

about the authors

about the cover illustration

  

Part 1. Introduction

  1 Infrastructure as Code

  1.1   Working with infrastructure

DevOps

Preventing configuration drift

  1.2   The benefits of Infrastructure as Code

IaC allows for automation

IaC allows for a declarative approach

IaC provides a human-readable format

  1.3   The Azure Resource Manager

Control plane and data plane

ARM templates

The Bicep language

Azure Service Management (ASM is not ARM)

  1.4   Other tools

AWS CloudFormation

Google Cloud Deployment Manager

Terraform

Pulumi

Choosing between cloud-specific and multi-cloud solutions

  2 Writing your first ARM template

  2.1   Working with JSON files

Installing the ARM templates extension in VS Code

  2.2   Writing ARM templates in VS Code

Adding a resource

Leveraging IntelliSense in VS Code

  2.3   Deploying an ARM template

  2.4   Monitoring template deployments

  2.5   Finding example templates

  2.6   Visualizing templates

Part 2. Taking it up a notch

  3 Writing ARM templates

  3.1   Resources

Child resources

  3.2   Parameters

Parameter types

Limiting and describing parameter values

Specifying parameter values

  3.3   Variables

  3.4   Outputs

  3.5   Functions

Expressions

Built-in functions

User-defined functions

  4 Deploying ARM templates

  4.1   An overview of the deployment process

  4.2   Submitting a deployment

Choosing a deployment scope

Submitting a template using different tools

  4.3   The execution phase

Role-based access control

Azure Policy

Resource locks

Resource provisioning

  4.4   The clean-up phase

Incremental deployment mode

Complete deployment mode

Combining deployment modes

  4.5   Template validation and what-if deployments

Validating an ARM template

What-if deployments

  4.6   Troubleshooting template deployments

  5 Writing advanced ARM templates

  5.1   Deploying to multiple scopes using nested templates

Nested templates on a management group

Evaluation scope

Outputs

  5.2   How to structure solutions

Small to medium solutions

Large solutions

  5.3   Modularizing templates with linked templates

Using a URI

Using a relative path

  5.4   Deploying resources in order

Explicit deployment ordering

Implicit deployment ordering

  5.5   Conditionally deploying resources

Applying conditions to output

  5.6   Using loops to create multiple resources

Using copy on variables

Using copy on properties

Using copy on output

Waiting for a loop to finish, using dependsOn

  5.7   Deployment scripts

  5.8   Reverse engineering a template

Exporting templates

Using Resource Explorer

Using the JSON view

For a new resource

  6 Simplifying ARM templates using the Bicep DSL

  6.1   Bicep: A transpiler

Deploying

Transpiling

Decompiling

  6.2   Bicep syntax differences

Parameters

Variables

Outputs

Conditions

Loops

Targeting different scopes

Known limitations

  6.3   Other improvements with Bicep

Referencing resources, parameters, and variables

Using references in variables and outputs

Referencing existing resources

Dependency management

String interpolation

No mandatory grouping

Comments

Using the contents of other files

  6.4   Modules

Deploying to another scope

Debugging Bicep deployments

  6.5   A larger Bicep example

AppConfiguration.bicep

ApplicationInsights.bicep

Configuration.bicep

  7 Complex deployments using Azure DevOps

  7.1   Meet Toma Toe Pizzas

  7.2   Crafting the Bicep files

Describing the App Service plan

Describing the App Service

Finalizing the template

  7.3   Storing templates in source control

  7.4   Automated build and release pipelines

Using triggers

Creating tasks

Grouping tasks in a job

Creating service connections

Configuring Azure DevOps to run your pipeline

  7.5   Adding logical phases to your pipeline

Identifying the logical phases

Accessing artifacts from different jobs

Transpiling Bicep in a pipeline stage

Deploying a template from a pipeline artifact

  7.6   Adding the Traffic Manager

Deploying the Traffic Manager

  7.7   Creating a real-world example pipeline

Completing the pipeline

  8 Complex deployments using GitHub Actions

  8.1   Forking a repository

  8.2   Getting to know GitHub Actions

Workflow events

Runners

Jobs

Steps

Actions

  8.3   Building a GitHub Actions workflow

Adding a job to a GitHub Actions workflow

  8.4   The deployment phase in GitHub Actions

Connecting to Azure from your GitHub workflow

Generating a service principal using the Azure CLI

  8.5   Deploying ARM templates from GitHub Actions

Completing the deployment

  9 Testing ARM templates

  9.1   Static analysis and validation

Visual Studio Code extensions

Validation using PowerShell or Azure CLI

ARM template test toolkit

Custom tests using Pester

  9.2   Unit tests

  9.3   Integration tests

  9.4   End-to-end tests

  9.5   Pester in CI/CD

Part 3. Advanced topics

10 Template specs and Bicep registries: Building a repository of templates

10.1   Use case: A repository of compliant resources

10.2   Creating a template spec

Listing template specs

Template spec versions

Creating a template spec from multiple ARM templates

Deploying a template spec using IaC is impractical

10.3   Deploying a template spec

Deploying template specs from an ARM or Bicep template

Upgrading to a newer version of the template spec

10.4   An alternative: A Bicep registry

10.5   Sharing templates using a package manager

Publishing an ARM template as a package

Deploying an ARM template that is in a package

Yet another approach

10.6   Design considerations

Choosing an approach

Pros and cons of template specs

Pros and cons of using a Bicep registry

Pros and cons of using a package manager

11 Using deployment stacks for grouping resources

11.1   Grouping resources by their lifetime

Complete deployment mode is not good enough

Deployment stacks to the rescue!

Creating a deployment stack

Updating a deployment stack

Removing a deployment stack

11.2   Provisioning resources for others, but disallowing updates

Azure Blueprints: A first solution

11.3   The future of deployment stacks

12 Governing your subscriptions using Azure Policy

12.1   Azure Policy

Policy definitions

Initiatives or policy sets

Assignment

12.2   Examining the built-in policies and initiatives

12.3   Using custom policies

Creating a custom policy

Testing a policy

12.4   Using the different effects

Append effect

Audit effect

AuditIfNotExists effect

DeployIfNotExists effect

Disabled effect

Modify effect

12.5   Creating your own initiative

12.6   Assigning a policy or initiative

12.7   Reviewing compliance status

Remediating noncompliant resources

Creating an exemption

13 Case studies

13.1   Building an Azure foundation

The management group layout

Assigning a policy initiative

Creating a management subscription

Creating workload subscriptions

13.2   Subscription level deployments

Configuring budgets

Configuring Microsoft Defender for Cloud

Creating resource groups and providing access

13.3   Creating a highly-available microservice architecture

Resources organized in resource groups

Networking with Bicep

Using the existing keyword to set access to a Key Vault

  

index

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.113.30