IaC

ARM & Bicep

Watch the presentation

Se presentationen på svenska


Infrastructure as Code (IaC) lets us define Azure resources declaratively and deploy them repeatably. This week we move from Portal & CLI to templates that describe our Ubuntu VM and its network—clean, versioned, and testable.

Why IaC (for our VM)

  • Consistent: same template → same VM, NIC, NSG, Public IP every time
  • Auditable: templates live in Git; PR review replaces “click ops”
  • Safe changes: use what-if to see impact before applying

ARM vs Bicep (quick compare)

  • ARM: verbose JSON; native to Azure Resource Manager
  • Bicep: concise DSL that compiles to ARM; better ergonomics, modules, linter
  • Engine: both deploy via Azure Resource Manager

Template anatomy (mini-map)

  • parameters: inputs (location, namePrefix, adminUser, sshKey, myIp)
  • resources: VNet/Subnet, NSG rules, Public IP, NIC, Ubuntu VM
  • outputs: public IP address (so we can browse Nginx)

Commands you’ll use

  • az deployment group what-if -f main.bicep -p dev.bicepparam
  • az deployment group create -f main.bicep -p dev.bicepparam
  • bicep decompile main.json and bicep build main.bicep
»

ARM & Bicep – Föreläsning 1 – Bilder

Varför IaC

  • Reproducerbart, granskningsbart, versionshanterat
  • Motverkar konfigurationsdrift
  • PR-granskning ersätter klick i portalen

ARM vs Bicep (samma motor)

  • ARM: JSON, mer omständligt
  • Bicep: kortfattad DSL, kompilerar till ARM
  • Verktyg: VS Code-tillägg, linter, moduler

Mallens anatomi

  • parameters: location, namePrefix, adminUser, sshKey, myIp
  • resources: VNet/Subnet, NSG, Public IP, NIC, Ubuntu VM
  • outputs: public IP

Arbetsflöde

az deployment group what-if -f main.bicep -p dev.bicepparam

az deployment group create -f main.bicep -p dev.bicepparam
  • Validera → Distribuera → Läs outputs
»

ARM & Bicep – Lecture 1 – Slides

Why IaC

  • Repeatable, auditable, versioned
  • Prevent config drift
  • Review with PRs instead of clicks

ARM vs Bicep (same engine)

  • ARM: JSON, verbose
  • Bicep: concise DSL, compiles to ARM
  • Tools: VS Code ext, linter, modules

Template anatomy

  • parameters: location, namePrefix, adminUser, sshKey, myIp
  • resources: VNet/Subnet, NSG, Public IP, NIC, Ubuntu VM
  • outputs: public IP

Workflow

az deployment group what-if -f main.bicep -p dev.bicepparam

az deployment group create -f main.bicep -p dev.bicepparam
  • Validate → Deploy → Inspect outputs
»