Azure Tenant Migration
Project Overview
Moving a production application between Azure tenants is one of those projects that looks simple in a slide deck and is not simple in practice: infrastructure, data, DNS, secrets, and CI/CD all have to move together, in the right order, with the application staying up the whole time.
The Challenge
- No Acceptable Downtime Window: The application had to stay available through the cutover
- Data in Flight: MongoDB data needed to migrate without loss or corruption
- Secrets Sprawl: The existing pipeline relied on long-lived service principal secrets stored in GitHub — exactly the kind of credential that shows up in a breach report
- New Organizational Boundary: The target tenant meant a new GitHub organization, new permission boundaries, and no assumption that old access carried over
Technical Solution
Infrastructure as Code, Ported Not Rebuilt
The application's Bicep templates were adapted to target the new tenant's subscription and resource naming conventions, rather than reconstructing the infrastructure by hand — the goal was a migration a future engineer could audit against source control, not a one-time manual effort nobody could reproduce.
Zero-Credential Pipeline Authentication
Rather than copying the old service-principal-secret pattern into the new GitHub org, the CI/CD pipelines were rebuilt on OIDC federated credentials: GitHub Actions exchanges a short-lived OIDC token for an Azure AD access token at pipeline runtime, scoped by RBAC to exactly the resources that pipeline needs. There is no long-lived secret sitting in GitHub's settings for an attacker — or a departing employee — to walk away with.
Data Migration
MongoDB data moved with a migration strategy designed around consistency checks before final cutover, rather than a single big-bang copy with no verification step.
Results and Impact
- Application, data, and CI/CD pipeline all live in the new tenant
- Zero long-lived Azure credentials stored anywhere in the new GitHub organization
- A documented, Bicep-defined infrastructure baseline in the new tenant — not a one-off manual setup
Key Learnings
Migrations like this are a forcing function: you find every place the "real" infrastructure diverged from what's in source control, and you find every credential that's been quietly living somewhere it shouldn't. Rebuilding the CI/CD trust model on OIDC federation instead of just relocating the old secrets was the right trade — more setup work, meaningfully less standing risk.