Exporting data from Azure DocumentDB

Surprisingly, as of ~mid-2017 there still not does not appear to be a simple "Download DB" and "Upload DB" type functionality for Azure CosmosDB (previously known as DocumentDB). Here is one option:

Caveat: Below method does not appear to support exporting attachments. If that is something you need, this might not work for you.

Export locally to a JSON file

Use the Azure DocumentDB Data Migration Tool to export and import DocumentDB collections.

In Source Information Page:

  1. Select DocumentDB as source
  2. In connection string, provide the connection string from the Azure Portal.

    • Format is: AccountEndpoint=http://blah.documentdb.com/;AccountKey=blahblah;Database=dbname To export, select "JSON file" as target and your documentDB as source
  3. Ensure Database valid exists in connection string, if not, append it.
    • Click Verify to ensure your connection works.
  4. Enter a valid collection name in the collection field.

sourceinformationpage


In Target Information Page:

  1. Export to JSON.
  2. Chose Local File and enter a valid path.
  3. (optional) Check Prettify JSON

targetinformationpage

Tested: 2017-06-16 against an Azure CosmosDB instance


There is no built-in export option in the database service itself. However, the DocumentDB Data Migration Tool, published by the DocumentDB team, is available and provides both import and export capabilities (export is to JSON). Everything is documented on the DocumentDB area of the Azure site, specifically here.

This isn't your only option, as you can write your own export app based on one of the existing language SDKs or direct REST API calls.

There may be other tools available, but getting into a which is the best tool for this discussion is off-topic. I'm only pointing out the Data Migration tool because the DocumentDB team provides it, along with official documentation.