Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to connect Azure Cosmos DB to MongoDB Compass

I am having trouble connecting my Azure CosmosDB to MongoDB Compass. I need clarification and assistance with the following settings:

  • Authentication = username and password from connection string?
  • Authentication Database = my CosmosDB database?
  • Replica Set Name?
  • Read Preference = Primary?
  • SSL?
  • SSH Tunnel?
like image 815
Brian Pace Avatar asked Mar 06 '23 00:03

Brian Pace


1 Answers

Cosmos DB uses Username/Keys instead of Username/Password authentication. In the Azure Portal for your Azure Cosmos DB instance, under Settings > Connection String, you will see your Connection Strings. It's all there:

enter image description here

Primary Connection String Example: mongodb://miubezzi-mongoapi:'Read-write Key'@miubezzi-mongoapi.documents.azure.com:10255/?ssl=true&replicaSet=globaldb

With the following Compass Connect information, I was able to connect. My Compass instance is currently syncing but I am connected. Will update with addition details.

enter image description here

enter image description here

And I am able to create a Database + Collection via Compass.

enter image description here

like image 176
Mike Ubezzi Avatar answered Mar 29 '23 13:03

Mike Ubezzi