Streamline your migration to Azure Cosmos DB for MongoDB (vCore-based) with a tool built for efficiency, reliability, and ease of use. Whether you're migrating data online or offline, this tool delivers a seamless experience tailored to your requirements. While it leverages mongodump
and mongorestore
internally for data transfer, you don’t need to learn or use these command-line tools yourself.
-
Flexible Migration Options
Supports both online and offline migrations to suit your business requirements. -
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. (Updatemain.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 P1V3 (Update
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!
You can deploy the utility either by compiling the source files or by using the precompiled binaries.
- Azure Subscription
- Azure CLI Installed
- PowerShell
This option involves cloning the repository and building the C# project source files locally on a Windows machine. If you’re not comfortable working with code, consider using Option 2 below.
-
Install .NET SDK
-
Clone the repository:
https://github.com/AzureCosmosDB/MongoMigrationWebBasedUtility
-
Open PowerShell.
-
Navigate to the cloned project folder.
-
Run the following commands in PowerShell:
# Variables to be updated $resourceGroupName = <Replace with Existing Resource Group Name> $webAppName = <Replace with Web App Name> $projectFolderPath = <Replace with path to cloned repo on local> # Paths - No changes required $projectFilePath = "$projectFolderPath\MongoMigrationWebApp\MongoMigrationWebApp.csproj" $publishFolder = "$projectFolderPath\publish" $zipPath = "$publishFolder\app.zip" # Login to Azure az login # Set subscription (optional) # az account set --subscription "your-subscription-id" # Deploy Azure Web App using Source Code (Option 1) Write-Host "Deploying Azure Web App..." az deployment group create --resource-group $resourceGroupName --template-file main.bicep --parameters location=WestUs3 webAppName=$webAppName # Configure Nuget Path. Execute only once on a machine dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org # Build the Blazor app Write-Host "Building Blazor app..." dotnet publish $projectFilePath -c Release -o $publishFolder -warnaserror:none --nologo # Archive published files Compress-Archive -Path "$publishFolder\*" -DestinationPath $zipPath -Update # Deploy files to Azure Web App Write-Host "Deploying to Azure Web App..." az webapp deploy --resource-group $resourceGroupName --name $webAppName --src-path $zipPath --type zip Write-Host "Deployment completed successfully!"
-
Open
https://<WebAppName>.azurewebsites.net
to access the tool. -
Enable Private Endpoint if required.
-
Download
app.zip
from the latest release athttps://github.com/AzureCosmosDB/MongoMigrationWebBasedUtility/releases
-
Open PowerShell.
-
Run the following commands in PowerShell:
# Variables to be updated $resourceGroupName = <Replace with Existing Resource Group Name> $webAppName = <Replace with Web App Name> $zipPath = <Replace with full path of downloaded zip file on local> # Login to Azure az login # Set subscription (optional) # az account set --subscription "your-subscription-id" # Deploy Azure Web App using Source Code (Option 1) Write-Host "Deploying Azure Web App..." az deployment group create --resource-group $resourceGroupName --template-file main.bicep --parameters location=WestUs3 webAppName=$webAppName # Deploy files to Azure Web App Write-Host "Deploying to Azure Web App..." az webapp deploy --resource-group $resourceGroupName --name $webAppName --src-path $zipPath --type zip Write-Host "Deployment completed successfully!"
-
Open
https://<WebAppName>.azurewebsites.net
to access the tool. -
Enable Private Endpoint if required.
Ensure you have:
- An existing Azure Virtual Network (VNet).
- A subnet dedicated to private endpoints (e.g.,
PrivateEndpointSubnet
). - Permissions to configure networking and private endpoints in Azure.
- Open the Azure Portal.
- In the left-hand menu, select App Services.
- Click the desired web app.
- In the web app's blade, select Networking.
- Under the Private Endpoint section, click + Private Endpoint.
Follow these steps in the Add Private Endpoint Advanced wizard:
- Name: Enter a name for the private endpoint (e.g.,
WebAppPrivateEndpoint
). - Region: Ensure it matches your VNet’s region.
- Resource Type: Select
Microsoft.Web/sites
for the web app. - Resource: Choose your web app.
- Target Sub-resource: Select
sites
.
- Virtual Network: Select your VNet.
- Subnet: Choose the
PrivateEndpointSubnet
. - Integrate with private DNS zone: Enable this to link the private endpoint with an Azure Private DNS zone (recommended).
- Click Next to review the configuration.
- Click Create to finalize.
- Return to the Networking tab of your web app.
- Verify the private endpoint status under Private Endpoint Connections as
Approved
.
If using a private DNS zone:
-
Validate DNS Resolution: Run the following command to ensure DNS resolves to the private IP:
nslookup <WebAppName>.azurewebsites.net
-
Update Custom DNS Servers (if applicable): Configure custom DNS servers to resolve the private endpoint using Azure Private DNS.
- Deploy a VM in the same VNet.
- From the VM, access the web app via its URL (e.g.,
https://<WebAppName>.azurewebsites.net
). - Confirm that the web app is accessible only within the VNet.