Migration Tool for Azure DocumentDB
Streamline your migration to Azure DocumentDB with a reliable, easy‑to‑use web app. Choose your migration tool and migration mode (offline, online, or sync only). The app orchestrates bulk copy and, for online jobs, change‑stream catch‑up. You don’t need to learn or use these command-line tools yourself.
Migration tool
- MongoDump and MongoRestore: Uses mongo-tools. Best for moving from self-hosted or Atlas.
- MongoDB Driver: Uses the driver for bulk copy and change stream catch-up.
- MongoDB Driver (Cosmos DB RU read optimized): Optimized for Cosmos DB Mongo RU as source. Uses RU-friendly read patterns.
Migration mode
- Offline: Snapshot-only copy. Job completes automatically when copy finishes.
- Online: Copies bulk data, then processes change streams to catch up. Requires manual Cut Over to finish.
- Sync Only: Skips the bulk data copy and processes change streams only, starting from a time you specify. Use it when the collections are already copied to the target and you just need to catch up (and keep) changes. Available for MongoDump and MongoRestore jobs.
Table of Contents
Key Features
Flexible Migration Options
Supports both online and offline migrations to suit your business requirements. It supports multiple tools to read data from the source and write it to the target. If you are migrating from on-premises MongoDB VM, consider using the On-Premises Deployment to install the app locally and transfer data to Azure DocumentDB. This eliminates the need to set up an Azure VPN.
User-Friendly Interface
No steep learning curve—simply provide your connection strings and specify the collections to migrate.
Automatic Resume
Migration resumes automatically in case of connection loss, ensuring uninterrupted reliability.
Private Deployment
Deploy the tool within your private virtual network (VNet) for enhanced security. (Update WebApp/main.bicep for VNet configuration.)
Standalone Solution
Operates independently, with no dependencies on other Azure resources.
Scalable Performance
Select your Azure Web App pricing plan based on performance requirements:
- Default: B1
- Recommended for large workloads: Premium v3 P2V3 (Update
WebApp/main.bicep accordingly.)
Customizable
Modify the provided C# code to suit your specific use cases.
Effortlessly migrate your MongoDB collections while maintaining control, security, and scalability. Begin your migration today and unlock the full potential of Azure Cosmos DB!
Azure Deployment Options
The MongoDB Migration Web-Based Utility can be deployed to Azure using three different options, each optimized for different workload requirements:
Option 1: Azure Web App (App Service)
Best for: Small to medium workloads and short-running migrations
- ✅ Quick and simple deployment
- ✅ Lower cost for smaller workloads
- ✅ Standard web application hosting
- ✅ Ideal for migrations under 24 hours
📖 Deploy to Azure Web App Guide
Option 2: Azure Container Apps (ACA)
Best for: Medium to large workloads and long-running migrations
- ✅ Configurable high-performance compute (up to 32 vCores, 64GB RAM)
- ✅ Persistent storage that survives deployments (100GB Azure File Share)
- ✅ Dedicated resources for intensive migrations
- ✅ Enterprise networking with VNet integration
- ✅ Ideal for migrations over 24 hours
📖 Deploy to Azure Container Apps Guide
Option 3: Azure Kubernetes Service (AKS)
Best for: Teams already operating AKS, multi-instance deployments, and Kubernetes-native operations
- ✅ Full Kubernetes control and workload portability
- ✅ One Deployment + LoadBalancer Service per instance
- ✅ Azure Blob storage via Workload Identity (no storage keys required)
- ✅ Flexible update workflow: full deploy, in-cluster image update, or publish/add new instance
📖 Deploy to Azure Kubernetes Service Guide
Choosing the Right Deployment
| Feature |
Azure Web App |
Azure Container Apps |
Azure Kubernetes Service |
| Workload Size |
Small to Medium |
Medium to Large |
Medium to Large |
| Migration Duration |
< 24 hours |
24+ hours |
24+ hours |
| CPU/Memory Model |
App Service plan sizing |
Dedicated workload profile sizing |
Node pool VM sizing |
| Persistent Storage |
App Service storage |
Azure File Share mount |
Azure Blob + Workload Identity |
| Deployment Time |
< 10 minutes |
~ 15-20 minutes |
~ 20-30 minutes |
| Operational Model |
PaaS web hosting |
Managed containers |
Kubernetes-native control |
| Best Use Case |
Quick migrations, dev/test |
Production, large-scale migrations |
If already using AKS |
Need Help Deciding?
- Start small? Use Azure Web App for quick setup and testing
- Production migration? Use Azure Container Apps for reliability and performance
- Already running AKS? Use Azure Kubernetes Service for cluster-native deployment and per-instance service control
- Not sure? Start with Web App and migrate to Container Apps if needed
On-Premises Deployment
Best for: Migrating from on-premises MongoDB VMs directly to Azure DocumentDB
- ✅ Eliminates need for Azure VPN setup
- ✅ Direct local access to source MongoDB
- ✅ Deploy on existing Windows Server infrastructure
- ✅ Full IIS-based hosting with .NET 9
📖 Deploy to On-Premises Windows Server Guide
How to Use
Schema Migration Tool
Optional. The same capabilities — collection creation, index migration (including unique indexes built before data copy), shard-key migration, and per-collection placement — are now built directly into the Migration Web App via Manage Collections (see Per-collection options, Indexing: blocking vs non-blocking, and Sharding and Move-to-shard). For most migrations you can skip this section and configure everything from the UI.
You may still want to run the standalone Schema Migration Tool in the /SchemaMigration folder when you need to: pre-stage the target schema independently of data movement, take advantage of its redundant compound-index removal and collection colocation heuristics, or script schema preparation as a separate CI/CD step. When you do use it, run the Migration Web App with Overwrite = False on each collection (so the data migration preserves the schema you already created — see Per-collection options) and pair it with Indexing strategy = Do not create indexes.
The Schema Migration Tool (located in the /SchemaMigration folder) analyzes your source MongoDB collections and prepares the target Azure DocumentDB environment up-front.
What It Does
The Schema Migration Tool analyzes your source MongoDB collections and intelligently transforms them for optimal performance on Azure DocumentDB. It handles:
- Collection Creation: Automatically creates target collections with appropriate configurations
- Index Migration: Transfers and optimizes indexes from source to target, including:
- Simple and compound indexes
- Unique indexes
- TTL (Time-To-Live) indexes
- Partial filter indexes
- Shard Key Migration: Optionally migrates sharding configurations for distributed collections
- Index Optimization: Identifies and removes redundant compound indexes to improve performance
- Collection Colocation: Groups related collections together for better query performance
When to use the standalone tool vs the built-in UI
| Need |
Use |
| Standard migration, want everything in one place |
Manage Collections (built-in) |
| Pre-stage schema separately from data movement |
Standalone Schema Migration Tool |
| Automatic redundant compound-index removal |
Standalone Schema Migration Tool |
| Heuristic-based collection colocation across shards |
Standalone Schema Migration Tool |
| Scripted / CI-driven schema preparation |
Standalone Schema Migration Tool |
Quick Start
cd SchemaMigration
python main.py --config-file <config.json> --source-uri <source_connection_string> --dest-uri <target_connection_string>
📖 Complete Schema Migration Guide
Recommended Workflow (when using the standalone tool)
- ✅ Schema Migration: Run the Schema Migration Tool to prepare your Azure DocumentDB environment
- ✅ Verify Schema: Confirm all collections, indexes, and shard keys are correctly created
- ✅ Data Migration: Use the main Migration Web App to copy your data, with Overwrite = False and Indexing strategy = Do not create indexes on each collection
- ✅ Validate: Verify data integrity and application compatibility
Important: When running data migration after schema migration, set each collection's Overwrite option to False in Manage Collections. This preserves the collections, indexes, and shard keys created by the Schema Migration Tool. With Overwrite = True, the data migration would drop and recreate the target collections, losing your optimized schema.
First-time sign-in
The web app is protected by a single application password.
- The first time you open the app, it redirects to the Change Password screen because no password has been set yet. Pick a strong password and submit — this becomes the application password.
- Subsequent visits go to the Login screen, where you enter the same password.