𝔖 Scriptorium
✦   LIBER   ✦

📁

Getting Started with Containers in Azure: Deploy Secure Cloud Applications Using Terraform

✍ Scribed by Shimon Ifrah


Publisher
Apress
Year
2024
Tongue
English
Leaves
221
Edition
2
Category
Library

⬇  Acquire This Volume

No coin nor oath required. For personal study only.

✦ Synopsis


Master the skills needed to deploy container services on Microsoft Azure using Terraform. This book will take you through the entire process of designing, deploying, and managing container services such as Azure Kubernetes Service (AKS), Azure Container Instances (ACI), Azure Container Registry (ACR), and Azure Web App for Containers.




 




In this fully updated second edition, Author Shimon Ifrah demonstrates how to use Terraform, PowerShell and Azure CLI to provision and manage container services in Azure. As you’ll be using Terraform as the main tool for deployment, a basic knowledge of Terraform is a prerequisite. In addition, you will see how Azure DevOps services can be used to deploy infrastructure and container services with Terraform using Azure Pipelines without using the Azure Portal. The book concludes with a tutorial on how to use Azure Defender for Cloud to safeguard Terraform and infrastructure-as-code against malicious threats, so you can deliver secure applications. 




Upon completing this book, you will have a thorough understanding of how to use Terraform to deploy secure and efficient cloud applications on Azure.




What You Will Learn




  • Leverage Terraform for the deployment of containerized services
  • Understand Azure DevOps Pipelines and Repos to deploy infrastructure and container services.
  • Safeguard your infrastructure-as-code and detect vulnerabilities using Azure Defender for the cloud








Who This Book Is For 



Azure administrators, developers, and architects who want to get started and learn more about containers and containerized applications on Microsoft Azure.

✦ Table of Contents


Table of Contents
About the Author
About the Technical Reviewer
Chapter 1: Getting Started with Azure and Terraform
Introduction
Goals of This Chapter
Tools and Services for the Setup
Visual Studio Code
Installing VS Code
VS Code Extensions
Installing VS Code Extensions
Windows Subsystem for Linux
Installing WSL on Windows 11
Azure CLI
Installing Azure CLI on Windows with WinGet
Installing Azure CLI on Linux
Installing Azure CLI on macOS
PowerShell 7
Installing PowerShell 7 on Windows
Installing PowerShell 7 on macOS
Installing PowerShell 7 on Linux
Terraform
A High-Level Example of Terraform
Installing Terraform on macOS
Enabling Terraform Tab Completion on macOS
Installing Terraform on Linux
Installing Terraform on Ubuntu
Enabling Terraform Tab Completion on Ubuntu
Installing Terraform on Windows
Terraform Package Manager
Installing tfenv on macOS
Installing tfenv on Linux
How to Use tfenv
Getting Started with Azure Infrastructure
Authenticating to Azure
Deploying Azure Infrastructure with Terraform
The “Terraform Init” Command
The “Terraform Plan” Command
The “Terraform Apply” Command
The “Terraform Destroy” Command
Summary
Chapter 2: Azure Web App for Containers
Introduction
Setting Up Web App for Containers
Provider Configuration
Web App for Containers Configuration
The “Terraform Plan” Command
The Terraform State File
Deploying Web App for Containers
Deploying the Code
Terraform Output
Creating an Output File
Using a Git Ignore File with Terraform
Using the Global Git Ignore File
Cleaning Up Our Deployment
Managing Web App for Containers
Scaling
Backing Up Web Apps
Customizing Deployment
Variable Interpolation
Securing Web App for Containers
HTTPS
Private Endpoints
Configuring Terraform for a Private Endpoint
Disabling Public Access to the Web App
Summary
Chapter 3: Azure Container Registry
Introduction
Key Features of Azure Container Images
Setting Up the Azure Container Registry
Terraform Configuration
Outputting Sensitive Information
Deploying the Azure Container Registry
Adding Tags
Noticing the Output
Building, Pushing, and Running Container Images with ASR Tasks
Pulling an Image from ACR
ACR Pricing Tiers
Managing the Azure Container Registry
ACR Tasks
Running Azure CLI Commands with Terraform
Terraform Null Resource
Securing ACR
Terraform Data Sources
Securing Our ACR Configuration
ACR Georeplication
Using ACR with Azure Web App for Containers
Using a Terraform Variables File
Configuring Azure Web App with ACR
Passing Variables Using “Terraform Apply”
Checking the Logs
Summary
Chapter 4: Azure Container Instances
Introduction
Key Benefits of ACI
Use Cases
Deploying Azure Container Instances
Full Code
Deploying Multiple ACI Containers
Using Azure Container Instances with Azure Container Registry
The “Variables.tf” File
The “Main.tf” File
Applying the Code
Mounting a Data Volume to an ACI Container
Storage Account
Azure File Share
Mounting Data Volume to the Container
The Complete Code
Managing Azure Container Instances
Connecting to a Running ACI Container
Using Azure CLI to Run Commands inside ACI
Viewing ACI Logs
Using Azure CLI to View Logs
Viewing Diagnostic Information
Reviewing Diagnostic Events
Enabling Advanced Log Collection
Configuring Azure Log Analytics
The Log Analytics Resource Block
Completing the Configuration Code
Viewing the Logs
Stopping, Starting, and Restarting ACI Containers with Azure CLI
Stopping the Container Group
Starting the Container Group
Restarting the Container Group
Liveness and Readiness Probes
Liveness Probes
Readiness Probe
Summary
Chapter 5: Azure Kubernetes Service
Introduction
About Kubernetes
Kubernetes Components
Kubernetes Master
Kubernetes Nodes
Kubernetes Add-Ons
Getting Started with AKS
Deploying the AKS Cluster
Connecting to AKS Using the Azure Command-Line Interface
Deploying an Application to the AKS Cluster
The “Deployment.yaml” File
Checking the Deployment Status
Deleting the Deployment
Scaling the Application
Enabling Autoscaling
Connecting the AKS Cluster to the Azure Container Registry
Using the ACR Container Image with AKS
AKS Volumes
Creating a Storage Class
Creating a Volume Claim
Configuring a Pod to Use a Persistent Volume
Upgrading an AKS Cluster
Autoupgrading the AKS Cluster
Terraform Remote State
Configuring the Remote State
Adding Backend Configuration
State Locking
Exporting Azure Resources to Terraform
Summary
Chapter 6: Azure DevOps and Container Service
Introduction
Azure DevOps Services
Setting Up Azure DevOps
Creating an Azure DevOps Organization
Creating a Project
Creating a Personal Access Token
Creating a Repository
Using Terraform with Azure DevOps
Installing Terraform Task
Azure Pipelines
Creating an Azure Container Registry
ACR.TF
AZURE-PIPELINES.YML
Creating an Azure Pipeline
Reviewing the Pipeline
Building and Pushing a Docker Image to ACR with Azure Pipelines
Using Terraform Destroy with Azure Pipelines
The AzAPI Provider
Deploying an ACR Using the AzAPI Provider
Full Code
Managing Secrets in Azure Key Vault and Azure DevOps
Deploying Azure Key Vault Using Terraform
Full Terraform Code
Creating a Secret in Azure Key Vault
Connecting Azure Key Vault to Azure Pipelines
Accessing Key Vault Secrets from a YAML Pipeline
Accessing Secrets from an Azure Pipeline
Summary
Chapter 7: Azure Compliance and Security
Introduction
Defender for Cloud
Setting Up Azure with Defender for Containers
Full Configuration Code
Checking the Deployment
Securing IaC Code with Defender for DevOps
Installing Extensions
Connecting the Azure DevOps Organization to Defender for DevOps
Enabling the Plan
Scanning a Terraform Pipeline for Vulnerabilities
Summary
Index


📜 SIMILAR VOLUMES


Getting Started with Containers in Azure
✍ Shimon Ifrah 📂 Library 📅 2024 🏛 Apress 🌐 English

<p><span>Master the skills needed to deploy container services on Microsoft Azure using Terraform. This book will take you through the entire process of designing, deploying, and managing container services such as Azure Kubernetes Service (AKS), Azure Container Instances (ACI), Azure Container Regi

Getting Started with Containers in Azure
✍ Shimon Ifrah 📂 Library 📅 2020 🏛 Apress 🌐 English

Deploy and execute Microsoft Azure container and containerized applications on Azure. This second book in author Shimon Ifrah’s series on containers will help you manage and scale containers along with their applications, tools and services. You’ll start by setting up the Azure environment and quick

Getting Started with Containers in Googl
✍ Shimon Ifrah 📂 Library 📅 2021 🏛 Apress 🌐 English

<p>Deploy, manage, and secure containers and containerized applications on Google Cloud Platform (GCP). This book covers each container service in GCP from the ground up and teaches you how to deploy and manage your containers on each service.<br>You will start by setting up and configuring GCP tool

Getting Started with Containers in Googl
✍ Shimon Ifrah 📂 Library 📅 2020 🏛 Apress 🌐 English

Deploy, manage, and secure containers and containerized applications on Google Cloud Platform (GCP). This book covers each container service in GCP from the ground up and teaches you how to deploy and manage your containers on each service. You will start by setting up and configuring GCP tools a