Azure Cosmos DB
Datafly Signal delivers events to Azure Cosmos DB for globally distributed, multi-model NoSQL storage with guaranteed single-digit millisecond latency.
Prerequisites
Before configuring Azure Cosmos DB in Signal, you need an Azure account with a Cosmos DB account (Core SQL API), a database, and a container.
Create an Azure Account
If you don’t already have one, sign up at azure.microsoft.com.
Create a Cosmos DB Account
- In the Azure portal, search for Azure Cosmos DB and click Create.
- Select Azure Cosmos DB for NoSQL (Core SQL API).
- Enter an Account Name (e.g.
datafly-events). - Select a Location close to your Signal deployment.
- Choose a Capacity mode:
- Serverless — pay per request, ideal for variable workloads.
- Provisioned throughput — reserve RU/s for predictable workloads.
- Click Review + Create > Create.
- Once deployed, note the URI (endpoint) from the account overview page.
Create a Database and Container
- Open your Cosmos DB account in the Azure portal.
- Go to Data Explorer in the left sidebar.
- Click New Database.
- Enter a Database ID (e.g.
analytics). - Click OK.
- Click New Container within the database.
- Enter a Container ID (e.g.
events). - Set the Partition key to
/message_id(or another high-cardinality field). - Click OK.
Choose a partition key with high cardinality to ensure even data distribution. The message_id field (unique per event) is a good default choice.
Get the Access Key
- In your Cosmos DB account, go to Settings > Keys.
- Copy the PRIMARY KEY (or Secondary Key as a backup).
- Note the URI if you haven’t already.
Store the access key securely. It provides full read/write access to the account. For production, consider using Azure RBAC with a managed identity instead of keys.
Configuration
| Field | Type | Required | Description |
|---|---|---|---|
endpoint | string | Yes | The Cosmos DB account endpoint URL (e.g. https://my-account.documents.azure.com:443/). |
database_id | string | Yes | The Cosmos DB database ID. |
container_id | string | Yes | The Cosmos DB container ID. |
partition_key_path | string | Yes | The partition key path for the container (e.g. /message_id). |
access_key | secret | Yes | The Cosmos DB account primary or secondary access key. |
Signal Setup
Quick Setup
- Navigate to Integrations in the sidebar.
- Open the Integration Library tab.
- Find Azure Cosmos DB or filter by Cloud Storage.
- Click Install, select a variant if available, and fill in the required fields.
- Click Install Integration to create the integration with a ready-to-use default blueprint.
API Setup
curl -X POST http://localhost:8084/v1/admin/integration-catalog/azure_cosmosdb/install \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Azure Cosmos DB",
"variant": "default",
"config": {
"endpoint": "https://datafly-events.documents.azure.com:443/",
"database_id": "analytics",
"container_id": "events",
"partition_key_path": "/message_id",
"access_key": "YOUR_PRIMARY_KEY"
},
"delivery_mode": "server_side"
}'Testing
- Enable the integration in Signal and trigger a test event on your website.
- In the Azure portal, open your Cosmos DB account > Data Explorer.
- Expand the database and container, then click Items.
- Verify that event documents are appearing with the correct partition key and data.
- In Signal, check the Live Events view to confirm delivery status shows as successful.
Troubleshooting
| Problem | Solution |
|---|---|
| Events not appearing in the container | Verify the endpoint, database ID, container ID, and partition key path are correct. |
Unauthorized (401) | The access key is invalid or has been regenerated. Get the current key from Settings > Keys. |
NotFound (404) | The database or container does not exist. Verify the IDs in Data Explorer. |
RequestEntityTooLarge (413) | Individual documents cannot exceed 2 MB. Check the event payload size. |
TooManyRequests (429) | You have exceeded the provisioned RU/s. Increase throughput or switch to autoscale. |
| Partition key mismatch | The partition_key_path must match the partition key defined on the container. Verify in Data Explorer > container Settings. |
| Credential errors | Verify the endpoint URL ends with :443/ and the access key is the full key string from the Keys page. |
Visit Azure Cosmos DB documentation for full API reference, partitioning strategies, and throughput management.