Dan Csharpster
Dan Csharpster

Reputation: 2732

How to import data into cosmos db emulator

I have a dev and qa Azure Cosmos Db database with 3 or 4 collections. I would like to be able to snapshot that data and copy it down locally so I can use it for local development with the Cosmos Db Emulator. I have seen the data migration tool and while it does mention copying FROM the Emulator, it does not mention if you can copy to the emulator. Does anyone know if it or another tool can copy from an Azure Cosmos Db to a local emulator and if so, are there any special steps to do so? Or is there an easier way to just export cosmos collections so I can import them locally? I tried just now and got the error "Request is being made with a forbidden encryption in transit protocol or cipher. I tried all 3 connection modes.

Thanks!

enter image description here

Upvotes: 2

Views: 2745

Answers (2)

NiharikaMoola
NiharikaMoola

Reputation: 5074

This connection issue might be caused by global changes in the OS or the browser settings that enable TLS 1.3 as default. Cosmos emulator only accepts and works with TLS 1.2 protocol.

Make sure that the Data migration tool uses Transport Layer Security (TLS) 1.2 when connecting to your Azure Cosmos accounts, use the .NET Framework version 4.7.

Change the settings and default to TLS 1.2; for instance, in IIS Manager navigate to "Sites" -> "Default Web Sites" and locate the "Site Bindings" for port 8081 and edit them to disable TLS 1.3. Similar operation can be performed for the Web browser via the "Settings" options.

Check this document for Troubleshoot connectivity issues.

Database migration tool for Azure Cosmos DB:

The Azure Cosmos DB Emulator supports only secure communication via TLS. The Azure Cosmos DB Emulator supports a single fixed account and a well-known authentication key for primary key authentication. This account and key are the only credentials permitted for use with the Azure Cosmos DB Emulator.

Construct the connection string as below in data migration tool for Source (Azure Cosmos DB) and Target (Cosmos DB enumalator).

AccountEndpoint=<CosmosDB Endpoint>;AccountKey=<CosmosDB Key>;Database=<CosmosDB Database>;.

enter image description here

Upvotes: 1

Sajeetharan
Sajeetharan

Reputation: 222582

Can you try this workaround suggested in the Github issue?

  • Get the current settings required from cmd: netsh http show sslcert >> C:\temp\netsh.output.txt
  • Search the output file for 0.0.0.0:8081 or whatever port you are using
  • Set the flags from cmd: netsh http update sslcert ipport=0.0.0.0:8081 appid={00000000-0000-0000-0000-9134d4f81626} certhash=b35df09d20000000000019ad39c6170000000000 certstorename=My disabletls13=enable

The values for appid and certhash should come from the output file captured in step 1. The important part is the disabletls13=enable. You need all these bits for the command to work.

Upvotes: 1

Related Questions