L4.1 β€” Backup Fundamentals 🟣

πŸ“ Level 4 Β· Protect Β· Chapter 1 of 4 Β Β·Β  Previous: L3.1 β€” Security Foundation Β Β·Β  Next: πŸ—ΊοΈ Curriculum Map β€” main path complete, pick your next column Β· Go deeper: L4.2 β€” PaaS Protection


Goal: protect the Level 1 virtual machines, and understand what a recovery point actually is. This chapter also contains the one decision the curriculum will not let you take back.

The IaC lesson: irreversible settings belong in the template as reviewed parameters β€” and dependsOn is how a template forces them to deploy before the resources that freeze them.


Who this is for Time You need first Cost while it runs
Chapter 1 of Level 4 Β· everyone ~20 min L1.1 only β€” the workflow’s include_web_tier toggle defaults off; tick it while L1.2 stands to protect the web VMs too 🟣 ~$0.06/hr added Β· ~$2.07/hr running total

[!WARNING] Vault redundancy freezes the moment the first item is protected. LRS, ZRS or GRS is chosen once, for the life of the vault β€” decide before you run this. L4.4 needs cross-region restore and cannot turn it on retrospectively.


What you’re building

One vault, one policy, four protected VMs. The template’s whole shape is an ordering constraint: vault redundancy lives on a storage config that is only writable while the vault has never protected anything, so that config deploys first and every protected item depends on it.

flowchart LR
  subgraph VMS["Level 1 VMs"]
    V1["vm-iacdemo-test"]
    V2["vm-iacdemo-web0..2"]
  end
  SC["storage config<br/>redundancy + CRR<br/>DEPLOYS FIRST"]
  POL["bkpol-iacdemo-daily<br/>30 daily Β· 12 weekly<br/>02:00 UTC"]
  VAULT["rsv-iacdemo-backup<br/>soft delete 14 days<br/>enhanced security"]
  ITEMS["protected items<br/>$10/month each"]

  SC --> VAULT
  POL --> VAULT
  V1 --> ITEMS
  V2 --> ITEMS
  ITEMS --> VAULT
  SC -. "freezes once<br/>ITEMS exist" .-> ITEMS

  classDef vm fill:#eefaf0,stroke:#3a9d5d,color:#1a1a1a
  classDef vault fill:#f5eefc,stroke:#7c4dbe,color:#1a1a1a
  classDef frozen fill:#fdecea,stroke:#c0392b,color:#1a1a1a
  class V1,V2 vm
  class VAULT,POL,ITEMS vault
  class SC frozen

Text description of this diagram</summary>

A Recovery Services vault, a policy, and the protected items that bind the two to the Level 1 VMs.

The red box is the ordering constraint that shapes the whole template. Vault redundancy and the cross-region restore flag live on the storage config, and they are only writable while the vault has never protected anything. The template therefore deploys the storage config first and makes the protected items depend on it β€” get that order wrong and the setting is frozen at whatever the default happened to be.

Soft delete is on with enhanced security, holding deleted recovery points for 14 days and requiring multi-factor authorisation to disable. It is what defeats β€œthe attacker deleted the backups too” β€” and it is also why deleting this lab does not immediately stop the storage meter.

</details>

Source: curriculum/L4.1-backup-fundamentals/main.bicep Β· main.bicepparam


πŸ” Going deeper β€” the semicolon-separated item names</summary>


Those semicolon-separated names are not a typo. Azure Backup addresses an IaaS VM through a container/item pair whose names encode the resource group and the VM name β€” iaasvmcontainer;iaasvmcontainerv2;<rg>;<vm>. Getting them wrong produces an unhelpful error, and it is the single most common reason this resource fails. Read the protectedItems loop in the template once, slowly.

</details>

πŸ” Going deeper β€” the permissions this needs</summary>

Azure RBAC β€” the minimum this chapter needs

Contributor on the lab resource group. Backup Contributor is the least-privilege equivalent.
Why: the vault, its policies and the protected items are all ordinary resources, and registering a VM needs write access to the VM as well as to the vault. Note what Contributor does not distinguish: Backup Operator can trigger backups and restores but cannot delete recovery points, and that split is the whole point of L4.3.
Microsoft Entra ID roles

None.
Azure Backup reaches the disks through the vault system-assigned identity, granted automatically at registration. No app registration, no consent, no directory role.

For more info β€” Azure RBAC roles for Azure Backup

</details>



[!NOTE] 🏫 Classroom: use the GitHub Actions option. Your Azure account holds Reader, so local az deployment commands will be refused β€” deploys go through your fork’s workflow, which uses the workshop deploy identity automatically. Compiling locally (az bicep build) works for everyone.

πŸš€ Deploy it β€” pick any one of three ways



1 Β· Bicep CLI
Copy-paste in the terminal


2 Β· GitHub Actions
One button in the browser


3 Β· GitHub Copilot
Ask AI in plain English



Β  Option 1 Β· Bicep from the terminal

az deployment group what-if --resource-group $env:AZURE_RESOURCE_GROUP --parameters curriculum/L4.1-backup-fundamentals/main.bicepparam
az deployment group create  --resource-group $env:AZURE_RESOURCE_GROUP --parameters curriculum/L4.1-backup-fundamentals/main.bicepparam

You should see: redundancy echoing your choice, crossRegionRestoreEnabled, and a redundancyIsFrozen output stating plainly that L4.4 cannot change it.

Decide redundancy before the first run, not after:

$env:CURRICULUM_VAULT_REDUNDANCY = "LocallyRedundant"   # half the storage price, no cross-region restore, ever
$env:CURRICULUM_CROSS_REGION_RESTORE = "true"           # needs GeoRedundant; L4.4 wants this



Β  Option 2 Β· GitHub Actions (push-button)

Actions β†’ β€œCurriculum L4 - Backup & Recovery Readiness” β†’ Run workflow β†’ L4.1 - Backup Fundamentals.

Two of the run inputs are the frozen decisions β€” Vault redundancy and Enable cross-region restore. They are surfaced as run inputs rather than buried in a parameter file precisely because nobody can fix them later.



Β  Option 3 Β· GitHub Copilot (plain English)

Load your values first: ./scripts/Load-LabSettings.ps1. Then in Copilot Chat β†’ Agent mode:

Deploy curriculum/L4.1-backup-fundamentals/main.bicep to my lab resource group ($env:AZURE_RESOURCE_GROUP) with az deployment group create.

Then ask it to do the impossible:

Change the redundancy on the existing vault in curriculum/L4.1-backup-fundamentals/main.bicep from GeoRedundant to LocallyRedundant and redeploy.

It will edit the parameter happily. The deployment then fails, because Azure refuses the change once an item is protected. This is a good failure to see once: the constraint lives in the platform, not in the template.



βœ… Verify it

Mode
Portal only
Time
~8 minutes
Goal
Understand vault state, protection state, and restore paths

[!IMPORTANT] This chapter has frozen decisions. Verify them now, before the estate grows.

Step 1 Β· Vault settings deep dive</summary>

Open rsv-<prefix>-backup and inspect:

  • Properties -> redundancy model (LRS/ZRS/GRS)
  • Backup Infrastructure -> cross-region restore setting
  • Security settings -> soft delete enabled, retention period

PASS: redundancy and CRR match what you intended, and soft delete is enabled.

</details>

Step 2 Β· VM protection state</summary>

In the vault, open Backup items -> Azure Virtual Machine.

PASS: vm-<prefix>-test appears as protected and is bound to the expected policy (bkpol-<prefix>-daily).

If web tier is enabled, confirm web VMs are listed too.

</details>

Step 3 Β· Recovery Center walkthrough</summary>

Open Recovery Center (search for it in Azure Portal), then:

  • Scope to your subscription/resource group.
  • Open Protected items and find vm-<prefix>-test.
  • Open Backup jobs and Backup alerts for a quick health view.

PASS: you can locate the VM, see its protection status, and find job history in one place.

</details>

Step 4 Β· Restore options overview (no restore run required)</summary>

From the protected VM item, open Restore VM and review available restore types.

PASS: you can explain the difference between a full VM restore and file-level recovery, and when each is appropriate.

</details>

Step 5 Β· Cost and teardown risk check</summary>

In the vault and Recovery Center, review protected instance count and stored recovery points.

PASS: you can explain why backup costs can continue after VM deletion until recovery points are removed and soft-delete retention expires.

</details>

[!TIP] If status looks stale, wait a few minutes and refresh. Backup jobs and protection health are not always instant in the portal.


GitHub feature spotlight Β· The template that owns a frozen decision

You just used it: redundancy and cross-region restore are parameters on this template, with the freeze written on them β€” so the decision is in the pull request, with a reviewer, rather than in a portal dropdown someone clicked past. Find it: the vaultRedundancy and enableCrossRegionRestore parameter descriptions, and the dependsOn that forces the storage config to land before any protected item. Beyond the lab: irreversible settings deserve review more than reversible ones, and code review is the only place that reliably happens. Docs β†’



➑️ What carries forward

This chapter completes the main path β€” deploy, monitor, secure, protect. Going deeper, L4.2 protects the data that is not on a disk β€” where β€œbackup” usually turns out to mean something already switched on that nobody has verified.


🧭 Where next?

Your situation Go to
Main path complete! Pick your next move β€” go deeper anywhere, or take the extra-credit tracks πŸ—ΊοΈ Curriculum Map
Go deeper here β€” protect the data that isn’t on a disk L4.2 β€” PaaS Protection
Extra credit β€” put Microsoft Sentinel on the workspace L5.1 β€” Sentinel Foundation
Extra credit β€” high availability and disaster recovery L6.1 β€” High Availability & Redundancy
Want the big picture of this level first Level 4 Β· Protect overview
Done for the day β€” the estate bills while idle Cleanup & Reset
Something didn’t work Troubleshooting