Connect to CosmosDB
You can connect to CosmosDB and make it available as a resource in Retool. Once complete, your users can write queries that interact with CosmosDB data.
Requirements
All users for Retool organizations on Free or Team plans have global Edit permissions and can add, edit, and remove resources. If your organization manages user permissions for resources, you must be a member of a group with Edit all permissions.
Allow Retool to access CosmosDB
If CosmosDB is behind a firewall, you must allow access from Retool's IP addresses. Add the IP addresses to your firewall's Allowlist before you create the resource.
To create a CosmosDB resource, you need:
- Authentication credentials for CosmosDB. This can be either a username and password, or AWS IAM authentication (for AWS-hosted MySQL databases).
- Connection details for CosmosDB. This includes the hostname, port, and database ID.
- Firewall rules that allow Retool to access CosmosDB.
CosmosDB authentication
Retool authenticates with CosmosDB using a master key token for the database.
1. Create a new resource
Sign in to your Retool organization and navigate to the Resources tab. Click Create new, then select Resource.
2. Select the resource type
Retool can connect to almost any API or database, and has built-in integrations for popular data sources. Select the CosmosDB resource type.
3. Configure the resource
Specify a name and folder for the CosmosDB resource. Retool displays the resource name and type in query editors to help users identify them.
Next, enter the following fields.
Setting | Description |
---|---|
Host | The URL or IP address. |
Port | The port number. |
Database Id | The database ID. |
Key | The master key token for the database. |
Click Test Connection to verify that Retool can connect to CosmosDB. If the test fails, check the resource settings and try again. Testing a connection only checks whether Retool can successfully connect to the resource. It cannot check whether the provided credentials have sufficient privileges or can perform every supported action.
4. Save the resource
Click Create resource to complete the setup. You can then click either Create app to immediately start building a Retool app or Back to resources to return to the list of resources
Wrap up
Your CosmosDB resource is now ready to use. To interact with CosmosDB data, select the resource in the query editor.