Edit

Import and export Azure Cosmos DB data in Visual Studio Code

What this feature does

The extension supports data movement operations for local workflows:

  • Import documents from JSON files.
  • Export documents or query results for validation and sharing.

Import documents from JSON

  1. Open the target container in Visual Studio Code.
  2. Select the import action.
  3. Choose a JSON file from your local machine.
  4. Confirm the import and monitor completion.
  5. Validate imported items by querying the container.

Import documents workflow in Visual Studio Code showing JSON file selection for an Azure Cosmos DB container.

Export documents from a container

  1. Open the container documents view.
  2. Select the export action.
  3. Choose full container export or current filtered view.
  4. Save output as JSON.

Export documents action in Visual Studio Code for Azure Cosmos DB showing options to export container data.

Export query results

  1. Run a query in the query editor.
  2. In results view, choose export.
  3. Save results in the supported output format.

Validation and troubleshooting

  • Validate required fields such as id and partition key after import.
  • If import fails, verify source JSON validity and document shape.
  • If export appears incomplete, confirm whether current filters limit rows.