To access your data in Microsoft Azure Cosmos DB, create a connection asset for it.
Azure Cosmos DB is a fully managed NoSQL database service.
Create a connection to Microsoft Azure Cosmos DB
To create the connection asset, you need these connection details:
- Hostname
- Port number
- Master key: The Azure Cosmos Database primary read-write key
Microsoft Entra ID is a cloud-based identity and access management service. To obtain connection values for the Entra ID authentication method, sign in to the Microsoft Azure portal and go to your storage account. For information about Microsoft Entra ID, see What is Microsoft Entra ID?.
Entra ID client secret credential
- Tenant ID: The Microsoft Entra tenant ID. To find the Tenant ID, go to Microsoft Entra ID> Properties. Scroll down to the Tenant ID field. For more information, see How to find your Microsoft Entra tenant ID.
- Client ID: The client ID for authorizing access to Microsoft Azure Cosmos DB. To find the Client ID for your application, select Microsoft Entra ID. From App registrations, select your application. Click Copy to copy the Client ID of your application. For more information, see Register a Microsoft Entra app and create a service principal.
- Client secret: The authentication key that is associated with the client ID for authorizing access to Microsoft Azure Cosmos DB. To find the Client secret for your application, select Microsoft Entra ID. From App registrations, select your application. Go to Certificates & secrets > Client secrets. Click Copy to copy the existing Client secret or click New client secret to create a new Client secret and copy it. For more information, see Register a Microsoft Entra app and create a service principal.
- Storage account URL: Storage account URL.
Entra ID username password credential
- Client ID: The client ID for authorizing access to Microsoft Azure Cosmos DB. To find the Client ID for your application, select Microsoft Entra ID. From App registrations, select your application. Click Copy to copy the Client ID of your application. For more information, see Register a Microsoft Entra app and create a service principal.
- Username and Password: Username and password for the Microsoft Azure Cosmos DB account. You need permission to access without multi-factor authentication.
- Storage account URL: Storage account URL.
For Private connectivity, to connect to a database that is not externalized to the internet (for example, behind a firewall), you must set up a secure connection.
Choose the method for creating a connection based on where you are in the platform
- In a project
- Click Assets > New asset > Connect to a data source. See Adding a connection to a project.
- In a catalog
- Click Add to catalog > Connection. See Adding a connection asset to a catalog.
- In a deployment space
- Click Import assets > Data access > Connection. See Adding data assets to a deployment space.
- In the Platform assets catalog
- Click New connection. See Adding platform connections.
Next step: Add data assets from the connection
Where you can use this connection
You can use Microsoft Azure Cosmos DB connections in the following workspaces and tools:
Projects
- Data Refinery (watsonx.ai Studio or IBM Knowledge Catalog)
- DataStage (DataStage service). See Connecting to a data source in DataStage.
- Decision Optimization (watsonx.ai Studio and watsonx.ai Runtime)
- Notebooks (watsonx.ai Studio). Click Read data on the Code snippets pane to get the connection credentials and load the data into a data structure. See Load data from data source connections.
- SPSS Modeler (watsonx.ai Studio)
Catalogs
-
Platform assets catalog
-
Other catalogs (IBM Knowledge Catalog)
Azure Cosmos DB setup
- Set up Azure Cosmos DB: Azure portal
- Secure access to data in Azure Cosmos DB: Master keys
Restrictions
- Only the Core (SQL) API is supported.
- When using Entra ID credentials for authentication with Azure Cosmos DB connection, creating or deleting a collection/container is not supported. Only listing existing collections and making changes to them is supported. For more information, refer to Azure Cosmos DB documentation.
Running SQL statements
To ensure that your SQL statements run correctly, refer to the Azure Cosmos DB documentation for the correct syntax.
Learn more
Parent topic: Supported connections