liveBook · Manning

Infrastructure as code

As explained in Azure Security

Infrastructure as code is the practice of defining and managing infrastructure through machine-readable configuration files and automation rather than manual procedures.

Infrastructure as code (IaC) describes the desired state of public-cloud infrastructure in code or templates. ARM, Bicep, Terraform, CloudFormation, and similar tools can deploy resources programmatically and make secure configuration the default rather than a manual afterthought. section 11.3

Use IaC to make infrastructure changes repeatable, track them with version control, and deliver approved updates through CI/CD. This helps prevent configuration drift, supports business continuity and disaster recovery, and lets teams deploy vulnerability fixes without manually changing production environments. section 11.3 section 11.9

IaC supports shifting security left by putting security configuration into the software development lifecycle. Detecting and correcting weaknesses earlier can reduce remediation costs and avoid taking revenue-producing applications offline to fix vulnerabilities or misconfigurations. section 11.1 section 11.2

A security-focused IaC workflow can:

  • Store application and infrastructure changes in a source-code repository, then use Git history to track template or code changes over time. section 11.3
  • Run configurable CI/CD workflows that build and test pull requests before merged changes reach production. section 11.3
  • Apply consistent security settings across subscriptions, such as enabling Microsoft Defender for Cloud plans programmatically. section 11.3.1

Enable cloud protection across subscriptions

A developer commits application changes to GitHub while a security administrator uses IaC and a GitHub Actions workflow to keep Azure security settings consistent. The workflow authenticates to Azure with a service principal and can enable Defender for Cloud plans on subscriptions that host the application. section 11.3.1

Figure 11.4 The GitHub Actions workflow can be used to programmatically enable Defender CSPM plan on your Azure subscriptions.

This workflow diagram illustrates IaC-driven enablement of the Defender CSPM plan across Azure subscriptions. section 11.3.1

IaC is one layer of a DevSecOps approach, not a complete security solution. Pair it with shared visibility of security findings so developers and security teams can prioritize and fix weaknesses found in code and configuration. section 11.9

How Azure Security covers it

How deep it goes
Defines desired-state IaC and explains version control, CI/CD workflows, drift prevention, and a Defender plan automation scenario.
Examples
Uses a GitHub Actions workflow, Azure service principal, Azure CLI, and Defender for Cloud plans across Azure subscriptions.
What it assumes
Assumes or accommodates varying GitHub familiarity while presenting concepts transferable to other repositories and CI/CD platforms.
What you can do after
Operate/configure repeatable Azure security deployments through IaC, version control, and CI/CD workflows.
How it connects
Connects IaC with DevSecOps, shifting security left, Git, CI/CD, GitHub Actions, Azure DevOps Pipelines, and Microsoft Defender for Cloud.

Also explained in

Compare how 14 books explain infrastructure as code →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Azure Security. The section links point to the parts of the book it draws on.