microsoft/azure-sub-migrator
Python
Captured source
source ↗microsoft/azure-sub-migrator
Language: Python
License: NOASSERTION
Stars: 10
Forks: 4
Open issues: 13
Created: 2026-03-12T19:28:24Z
Pushed: 2026-06-19T04:43:22Z
Default branch: main
Fork: no
Archived: no
README:
Azure Sub Migrator
Azure Sub Migrator – Azure Tenant-to-Tenant Subscription Migration Tool
A modular, open-source tool that helps you migrate Azure subscriptions and resources from one Microsoft Entra (Azure AD) tenant to another — via CLI or a Web UI.
---
Features
| Capability | Description | |---|---| | Resource scanning | Identify resources impacted by a tenant transfer with timing & required actions | | Pre-transfer readiness check | Detect blockers (AKS, SQL Entra auth) and warnings before you transfer | | RBAC export / import | Back up and restore role assignments, custom roles, and managed identities | | Interactive checklist | Step-by-step web-based migration checklist | | PDF & Excel reports | Branded, exportable reports for stakeholders and change-advisory boards | | Migration plan | Human-readable Markdown + machine-readable JSON plan | | IaC generation | Export ARM, Bicep, and Terraform templates for non-movable resources | | Subscription transfer | Optionally initiate the "change directory" process | | Multi-tenant auth | Works across any Azure tenant — CLI, Service Principal, or Managed Identity |
Architecture
azure_sub_migrator/
├── __init__.py # Package metadata
├── cli.py # Click-based CLI entry point
├── auth.py # Authentication (CLI / SP / MI)
├── scanner.py # Resource enumeration & classification
├── iac_generator.py # ARM / Bicep / Terraform export
├── migration_plan.py # Orchestrator – scan → classify → export → report
├── transfer.py # Subscription transfer ("change directory")
├── rbac.py # Role assignments & managed identities
├── reporter.py # Markdown report writer
├── report_export.py # PDF & Excel report generation
├── readiness.py # Pre-transfer readiness checks
├── config.py # YAML / env-var configuration
├── constants.py # Non-movable resource types & suggested actions
├── exceptions.py # Custom exception hierarchy
└── logger.py # Centralized loggingQuick Start
Prerequisites
- Python 3.9+
- Azure CLI (
az) — logged in to the source tenant - *(optional)*
aztfexportfor Terraform exports - *(optional)*
azcopyfor data migration
Installation
git clone https://github.com/microsoft/azure-sub-migrator.git cd azure-sub-migrator # Create a virtual environment python -m venv .venv .venv\Scripts\activate # Windows # source .venv/bin/activate # macOS/Linux # Install in editable mode with dev dependencies pip install -e ".[dev]"
Usage
# Verify authentication azure-sub-migrator login # List subscriptions azure-sub-migrator list-subs # Scan a subscription for movable vs non-movable resources azure-sub-migrator scan -s # Generate a full migration plan with IaC templates azure-sub-migrator plan -s -t # Initiate subscription transfer (dry-run first!) azure-sub-migrator transfer -s -t --dry-run
Configuration
You can provide settings via:
1. YAML file — --config config.yaml (see samples/sample_config.yaml) 2. Environment variables — prefixed with AZ_MIGRATE_ (e.g. AZ_MIGRATE_SUBSCRIPTION_ID) 3. CLI flags — override everything (e.g. --tenant-id, --auth-method)
Web UI
Azure Sub Migrator includes a full Flask + Bootstrap 5 web dashboard.
Setup
1. Register an Entra ID app with a Web redirect URI of http://localhost:5000/auth/callback. 2. Copy .env.example to .env and fill in your credentials. 3. Start the server:
# Set environment variables (PowerShell) $env:ENTRA_CLIENT_ID = "" $env:ENTRA_CLIENT_SECRET = "" $env:FLASK_SECRET_KEY = [guid]::NewGuid().ToString() python -m web.wsgi
4. Open http://localhost:5000 and sign in with your Microsoft account.
Web Features
- 📊 Dashboard — view and scan subscriptions
- 🔍 Resource scanning — live progress with polling
- ✅ Interactive checklist — step-by-step migration guide
- 🛡️ RBAC export — download role assignments as JSON
- ⚡ Readiness check — detect blockers before transfer
- 📄 PDF report — branded, multi-page migration report
- 📗 Excel report — 3-sheet workbook with filters and summary
Running Tests
pytest -v --cov=azure_sub_migrator
Contributing
We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
Code of Conduct
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
Security
If you discover a security vulnerability, please see [SECURITY.md](SECURITY.md) for reporting instructions. Do not open a public GitHub issue for security vulnerabilities.
Trademarks
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.
License
[MIT](LICENSE)
Excerpt shown — open the source for the full document.
Notability
notability 3.0/10Routine utility repo with low traction.