Freigeben über


Connecting Data Explorer to Cosmos DB: where and what is my connection string?

Azure's CosmosDB is changing so fast, keeping up with the process for even simple tasks can be a challenge. I had to dig to find this, so figure'd I'd share to save the next person some time:

Scenario: I have created a new CosmosDB collection, and want to load some data into it. This can be done through the preview tool "Azure CosmosDB Data Migration Tool" (https://azure.microsoft.com/en-us/updates/documentdb-data-migration-tool/) but I got stuck trying to find my empty collection's Connection String. You can find  the CosmosDB's connection string in the "Keys" blade in the Azure Portal, and using the copy button against my secondary connection string below:

However, trying to use this connection string in Data Explorer failed when I clicked "Verify" , with the error "Documents database name should be provided as part of the connection string".

It turns out the error is pretty accurate - I needed to append the database name to the connection string I had copied out of Azure. So, I opened up trusty notepad, pasted in the "secondary connection string" I had originally tried, and hand appended a "; Database=" and the name of my database (Power Plant for this particular dataset).

I then copy/pasted this into Data Explorer, clicked "Verify", and achieved success! On to my next battle!