Today I spent a huge chunk of my workday cleaning up leftover junk: old cloud resources, forgotten repos, and Entra ID app registrations nobody remembered existed.

Some of this mess came down to rushed, lazy planning. Some was from teammates who’d moved on and never tidied up their work before they left. Sitting there deleting it all, I found myself thinking — isn’t this exactly what everything‑as‑Code is supposed to fix?

Turns out: no.

IaC is fantastic, but it only manages the resources you remembered to put INTO your IaC repo. If someone quickly clicks together a test Entra ID app registration, spins up a temporary demo environment, or builds a quick prototype outside the repo — those things become invisible ghosts your pipelines will happily ignore. Even worse when the person who created them leaves the company; JML processes disable their user accounts and completely miss the orphaned service principals and repos they owned.

My first instinct was a strict rule: every single resource must have a baked‑in exit plan with regular attestation to prove it still needs to stay alive. But then the risk hit me — what if someone forgets to submit that attestation? Hard automatic deletion would be catastrophic, taking down critical production systems with zero warning.

That’s why I’m pushing for this balanced workflow instead:

🏷️ 1. Mandatory metadata tagging for EVERY resource

Cloud resources, repos, Entra ID registrations — all of them get tags:

  • owner_team
  • expiry_date (yes, even production — just longer, 90‑180 day cycles)
  • business_justification
  • managed_by (IaC / manual)

Nothing is marked permanent forever. Everything needs periodic sign‑off to extend its life.

⏱️ 2. Four‑stage lifecycle (NO instant deletion)

✅ Warning (7‑14 days before expiry)
Automated scans send alerts/tickets to owners reminding them to attest their resource is still required.

✅ Quarantine on expiry
Disable secrets / stop resources / archive repos — DO NOT DELETE. Everything is still reversible. This is your safety net for the inevitable “we forgot to attest production” scenario.

✅ Grace period
Give the team 30‑60 days to spot the quarantined resource and restore it.

✅ Final permanent deletion
Only clean‑up once the grace window has passed with no restoration request.

🔍 3. Independent inventory scanner (separate from your IaC)

Your IaC defines your desired state. Run a separate auditor that hunts for shadow resources: orphaned Entra ID apps, inactive repos, resources missing mandatory tags. Flag those for the team — either add them into IaC or schedule them for the lifecycle workflow.

🧾 4. Add resource handover to your offboarding checklist

When engineers leave, don’t just disable their accounts. Transfer ownership of their resources, audit their app registrations, and kick‑off the attestation review for anything they owned.

💭 Closing thought

IaC builds the world. Lifecycle management keeps the clutter out of it. Baking in exit plans is absolutely the right direction — just make sure you build that quarantine safety buffer before you even think about hitting delete.

💬 Question for the community: How does your team handle stale Entra ID app registrations? Quarantine first, or jump straight to deletion? Drop your workflows in the comments — I’d love to learn more.