1

How to copy data, one collection, from one Cosmos DB API for MongoDB account to another Cosmos DB API for MongoDB account, in another subscription, placed in another Azure region. Preferably do it periodically.

Michael Chudinov
  • 2,620
  • 28
  • 43

1 Answers1

1

You can use Azure Data Factory to easily copy a collection from one Cosmos DB API for MongoDB account to another Cosmos DB API for MongoDB account, in any other subscription, placed in any other Azure region simply using Azure Portal.

You need to deploy some required components like Linked Services, Datasets and Pipeline with Copy data activity in order to accomplish this task.

  1. Use Azure Cosmos DB (MongoDB API) Linked Service to connect the Azure Data Factory with your Cosmos DB Mongo API account. Refer Create a linked service to Azure Cosmos DB's API for MongoDB using UI for more details and step to deploy.
  • Note: You need to deploy two Azure Cosmos DB (MongoDB API) Linked Service, one for source account from where you need to copy the collection, and another for destination account where the data will be copied.
  1. Create Datasets by using Linked service created in above step. Your dataset will connect you to the collection. Again you need to deploy two datasets, one for source collection and another for destination collection. It will look like as shown below.

enter image description here

  1. Now create a pipeline using Copy data activity

enter image description here

  1. In Source and Sink tab in copy data activity settings, select the source dataset and sink dataset respectively which you have created in step 2.

enter image description here

  1. Now just Publish the changes and click on Debug option to run the pipeline once. The pipeline will run and collection will be copied at destination.

enter image description here

If you want to run the pipeline periodically, you can create Trigger based on event or any specific time. Check Create a trigger that runs a pipeline on a schedule for more details.

Utkarsh Pal
  • 4,079
  • 1
  • 5
  • 14