Database Connections
Goal: Give your workspace a database it owns, and connect historical data from databases you already run.
Current Status
| Feature | Status |
|---|---|
| CosmosDB accounts, provisioned from the UI | Available |
| Container and document management from the UI | Available |
| Per-container table APIs | Available |
| SQL, PostgreSQL, MySQL, MongoDB, Azure Data Explorer | Custom code |
The UI path provisions CosmosDB accounts into your own Azure subscription. Other databases — ones you already run — still connect through custom integration code, covered further down this page.
Option A: Provision a CosmosDB account from the UI
- Open Environment in the workspace toolbar and choose Databases
- Sign in to Azure inside the modal if your session has expired
- Name the account and pick a scaling profile by name —
Serverless,StandardorHigh volume - Choose Save & Provision
- Watch the account's row move to Live — provisioning runs in the background and the list updates as it completes
- Drag a Database node from the Node Bank onto the canvas and choose the account it lives in
There is nothing to paste. The account is created in your own connected Azure subscription, and its credentials are resolved server-side — there is no endpoint field, no account key, and no connection to test.
The account is where data physically sits, which is why its region is fixed when it is created.
Your first account is created in your workspace landing zone region — that is not a choice made in this modal. Any additional account must state its own region, because it is not inherited from your landing zone. Each region is a separate CosmosDB account with its own cost floor.
→ Full walkthrough: CosmosDB Setup
Option B: Ask Azi
Azi can propose the records for you. Ask for what you want in plain language — "add a database for sample records in the home store" — and Azi drafts a proposal you review before it is applied.
Custom Code Approach
For databases you already run — Azure Data Explorer, SQL Server, PostgreSQL and others — you can build custom integrations.
Architecture
Your Database → Custom Integration Code → OpenIndustrial API → Control Plane
Example: Azure Data Explorer Integration
import { Client as KustoClient } from 'azure-kusto-data';
// Connect to your Azure Data Explorer cluster
const client = new KustoClient(
'https://your-cluster.region.kusto.windows.net',
{ /* auth config */ }
);
// Query your database
const results = await client.execute(
'your-database',
`YourTable | where timestamp > ago(1h) | summarize avg(value) by bin(timestamp, 5m)`
);
// Push to OpenIndustrial via API
const response = await fetch(
'https://www.openindustrial.co/api/workspaces/{workspace}/data-import',
{
method: 'POST',
headers: {
'Authorization': `Bearer ${apiToken}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
source: 'adx-historical',
data: results.primaryResults[0].toJSON(),
}),
}
);
Example: SQL Server Integration
import sql from 'mssql';
const config = {
server: 'your-server.database.windows.net',
database: 'your-database',
user: 'your-user',
password: process.env.SQL_PASSWORD,
options: { encrypt: true },
};
// Connect and query
const pool = await sql.connect(config);
const result = await pool.request().query(`
SELECT timestamp, sensor_id, temperature, humidity
FROM telemetry
WHERE timestamp > DATEADD(hour, -1, GETUTCDATE())
`);
// Transform and push to OpenIndustrial
for (const row of result.recordset) {
await pushToOpenIndustrial({
deviceId: row.sensor_id,
timestamp: row.timestamp,
temperature: row.temperature,
humidity: row.humidity,
});
}
Supported Databases
Custom integrations work with any database that has a Node.js/Deno driver:
| Database | Package |
|---|---|
| Azure Data Explorer | azure-kusto-data |
| Azure SQL / SQL Server | mssql |
| PostgreSQL | pg |
| MySQL | mysql2 |
| MongoDB | mongodb |
Deployment Options
Run your custom integration as:
| Option | Best For |
|---|---|
| Azure Functions | Event-driven, serverless |
| Container | Continuous polling |
| Deno Deploy | Lightweight, edge-deployed |
| On-premises | Air-gapped environments |
Security Considerations
Use read-only database accounts. Never give write access to integration code.
- Store credentials in environment variables or secret managers
- Use managed identities where possible (Azure)
- Enable query auditing on the database side
- Implement rate limiting to prevent overload
These apply to the custom code path, where you hold the credentials. A CosmosDB account provisioned from the UI has no credential for you to store.
Next Steps
| If you want to... | Go to... |
|---|---|
| Provision a CosmosDB account | CosmosDB Setup → |
| Manage containers and documents | Database Management → |
| Publish a container's documents over HTTP | Database Tables → |
| Connect external APIs | External API Guide → |
| Build queries on imported data | Warm Queries Guide → |
| Connect IoT devices | IoT Hub Guide → |