Connect to Azure CosmosDB with MongoDB API from Studio 3T for Mongo

Let's assume you've created a CosmosDB database with MongoDB API in Azure and you would like to connect to it using Studio 3T for MongoDB. Follow these steps to connect.

In Studio 3T, click the Connect button and then click New Connection—this will open the new connection dialog box. At this point you will also want to connect to Azure and open your CosmosDB database.

img1.jpg

You need to get the connection details for the 3T dialog from your CosmosDB database configuration. In Azure, click on the Azure Cosmos DB link, and then click the target database, this should bring you to the database overview. You will see a tree view of options, under settings, click on the Connection String link, this is where you will get all the details to connect to your CosmoDB database.

In the 3T connection dialog, select Direct Connection for the Connection Type, for the Server you will use the HOST name from Azure. CosmoDB does not use the default MongoDB port so make sure you use the correct port from Azure. Once you have finished adding your server name and port you can click on the Authentication tab.

img2.jpg

For the Authentication Mode, select the Basic MongoDB type. For the User name, copy the USERNAME from Azure. For the Password, copy the PRIMARY PASSWORD from Azure. Authentication DB is admin and you can optionally configure the "Manually list visible databases" option as seen in the screen shot above. Now we are ready to move on to the SSL tab.

img3.jpg

Check the box to "Use SSL protocol to connect" and then click the "Accept server SSL certificates trusted by the operating system" option.

Save the connection and then click connect.