Connecting to Azure Cosmos DB with MongoDB Drivers



Azure Cosmos DB offers a way for developers and DBAs to balance availability, read scalability, and latency with five pre-configured consistency levels. The data in an Azure Cosmos DB account can be exposed with several APIs, including the MongoDB API. The CData Software Drivers for MongoDB provide a SQL-like interface to MongoDB data through standards-based drivers, allowing users to see their data in the BI, reporting, and ETL tools of their choice, as well as in custom tools and applications.

This article walks through configuring an Azure Cosmos DB account to use the MongoDB API and connecting to the account through any of the available CData Software MongoDB drivers.


Creating a Cosmos DB Account



To create a Cosmos DB account using the MongoDB API, log in in to your Azure Portal, select Azure Cosmos DB, and click to add a new account. Create an ID for your account and choose MongoDB as the API for the account. You can also configure the subscription, resource group, and location of your Cosmos DB account.


Connecting to a Cosmos DB Account



With your account created, make note of the connection properties for the account (found in the connection string settings).

The table below describes the mapping from the Cosmos DB connection properties to the CData Driver properties:

CData Driver Property Azure Cosmos DB Property
Server HOST
Port PORT
User USERNAME
Password PASSWORD
Use SSL SSL

With the properties mapped, you can quickly connect to your Azure Cosmos DB account using any of the MongoDB Drivers. Download a free trial of any of the drivers to start working with your Cosmos DB data in the BI, reporting, ETL, and custom tools that you are already using.