Interview Prep/Azure/CI/CD and IaC

Developers want ephemeral environments per PR on Azure. How do you build it?

AdvancedScenarioCI/CD and IaC
Answer

Situation read → Namespace per PR on a shared AKS cluster (cheap) or RG per PR (more isolation).

What I'd do →

  1. On PR open: create namespace pr-123, deploy with Helm using the PR image, ingress host pr-123.dev.devopsshack.com
  2. Backing services: shared dev database with a per-PR schema, or containers in the namespace
  3. Comment the URL on the PR
  4. On PR close: helm uninstall and delete the namespace; nightly cleanup of orphaned namespaces by label age

Why → Reviewers test real deployments; namespaces keep cost low.

Interview tip → Mention cleanup automation; orphaned environments are the cost trap.

Azure All Azure questions Roadmap: AKS & Azure DevOps

More on CI/CD and IaC