In my case, to interact Azure CosmosDb API for MongoDb we need to create a dedicated new folder under %localappdata%\CosmosDbEmulator and enable MongoDb endpoint v3.6 (see below PowerShell command in Step 1).
Note: For any reason if CosmosDb emulator is reset to default folder path %localappdata%\CosmosDbEmulator (or) fail to connect in Robo 3T
then always execute the below PowerShell script in Step 1 once again.
Note: From Robo 3T v1.4 onwards we don't have SSL tab in connection
Settings dialog. Instead we have a tab TLS.
1. Download and install Azure CosmosDb Emulator from https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator?tabs=powershell%2Cssl-netstd21
2. Download and install Robo 3T (1.4.2 or latest) from https://robomongo.org/download
3. To show Azure CosmosDb emulator related database(s) in Robo 3T client app
Step 1
- Launch Azure CosmosDb Emulator
(Optional: Just to check CosmosDbEmulator is started successfully)
- Open Powershell as administrator and execute below commands
# PowerShell Script
# Change directory to default location where CosmosDb emulator is installed.
cd\
cd '.\Program Files\Azure Cosmos DB Emulator\'
# [Optional] If any cosmosDb emulator instance is running then shutdown
.\Microsoft.Azure.Cosmos.Emulator.exe /shutdown
# To interact Azure CosmosDb API for MongoDb, create a new folder "<MongoDb>" under
# %localappdata%\CosmosDbEmulator and enable MongoDb endpoint v3.6
.\Microsoft.Azure.Cosmos.Emulator.exe /DataPath="$env:localappdata\CosmosDBEmulator\MongoDb" /EnableMongoDbEndpoint=3.6
Step 2
- Now CosmosDb emulator will be successfully started,
and launches the URL https://localhost:8081/_explorer/index.html in the browser
- Note down MongoDb connection string details from browser which will be required
while creating new Robo 3T connection. The default MongoDb connection string format is
mongodb://username:password@host:port/[database]?ssl=true
- Username: localhost
- Password (Primary Key): C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==
- Port: 10255
- Database: admin
Step 3
- Launch Robo 3T
- Click on Create new connection
- In "Connection" tab
- Provide Name of the connection as "<CosmosDbEmulator>"
- Add port number as 10255
- In "Authentication" tab provide details noted down in previous Step 2
- Check "Perform authentication"
- Add Database as "admin"
- Add Username as "https://localhost:8081"
- Add Password as "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw=="
- In "TLS" tab provide
- Check "Use TLS protocol"
- From Authentication Method dropdown select "Self-signed Certificate"
- Click on "Test" button.
- It should successfully connects to localhost:10255 via TLS tunnel
- It should successfully authorise to database "admin"
- Click on "Save" button
- Click on "Connect" button.
- It will show the admin database and its related collections.