---
title: "Azure Cosmos DB Integration"
description: "Connect AI agents to Azure Cosmos DB through the Core (SQL) API. Agents manage databases and containers and create, read, query, replace, upsert, and delete documents."
url: https://flowrunner.ai/integrations/azure-cosmos-db
date_modified: 2026-08-01T02:40:32-07:00
---

# Azure Cosmos DB

[Database](https://flowrunner.ai/integrations/category/databases-warehouses)

Connect AI agents to Azure Cosmos DB through the Core (SQL) API. Agents manage databases and containers and create, read, query, replace, upsert, and delete documents.

[Verified](https://flowrunner.ai/integrations/verified "What does verified mean?") · 15 actions · Custom auth · available

[Azure Cosmos DB website](https://azure.microsoft.com/en-us/products/cosmos-db) · [Platform Documentation](https://learn.microsoft.com/en-us/azure/cosmos-db/) · Capability data verified 2026-07-14

1.  An upstream step produces application state to persist
2.  Agent runs Upsert Document to write the record, keyed by its partition key value
3.  Agent reads back the stored document
4.  Agent runs Query Documents with parameterized SQL to find related records
5.  Agent runs Replace Document to update a record in place
6.  Agent reports the sync summary to the team via Slack
7.  Any Delete Container or Delete Database pauses for approval

## What This Integration Enables

Agents persist and retrieve application state, events, or records in a globally distributed store, provision databases and containers as part of environment setup, run parameterized SQL queries with cross-partition execution enabled, upsert or replace documents to keep a container in sync with an external source, and page through documents with continuation tokens. Query Documents runs parameterized SQL with cross-partition execution, so filtering on the partition key is not required, though gateway-served queries do not support ORDER BY, aggregates, or GROUP BY.

### Without FlowRunner

**Hand-rolled signing**: Reaching Cosmos DB means implementing master-key HMAC by hand

**Partition key friction**: Every point operation needs the partition key wired correctly

**Container drops unguarded**: Deleting a container or database removes data with no checkpoint

### With FlowRunner

**Signing handled**: The connector signs every request; the agent just calls the action

**Partition key managed**: Provide the raw partition key value; the header is serialized for you

**Guarded structure drops**: Delete Container and Delete Database pause for human approval

## Use Case Scenarios

### Keeping a container in sync

An upstream connector produces records. The agent calls Upsert Document for each, keyed by its partition key value, so the container stays in sync with the source: existing documents are replaced, and new ones are created. Re-running the flow never duplicates a record.

### Tenant provisioning

When onboarding a new tenant, the agent calls Create Database and Create Container to provision storage with a defined partition key path, then logs the created resource ids for tracking, mirroring them into [Azure Table Storage](https://flowrunner.ai/integrations/azure-table-storage) as a cheaper structured record. Provisioning becomes a repeatable flow step.

### Teardown with a human gate

At the end of a tenant's lifecycle, an agent is asked to remove its container or database. Before it runs Delete Container or Delete Database, it does not act on its own. It routes the resource id and a summary for approval, and deletes it only after a person confirms.

## Human-in-Loop Highlight

Deleting a container or a database in Cosmos DB removes every document inside it, and there is no undo from the flow. FlowRunner's answer is human-in-the-loop, an execution pattern where the agent pauses on its own, assembles the context and the choices, routes to a human on their preferred channel, and resumes the moment they respond. When a flow reaches Delete Container or Delete Database, the agent pauses before executing and asks through Slack: "Ready to Delete Container `orders` in database `tenant-42`. This removes all of its documents. Approve or cancel?" The delete runs only after a person confirms, with the approver and timestamp captured in the run log. A connector can drop any container; an orchestration layer knows which drops should stop and ask.

Agent processes routinely

Detects exception requiring judgment

Clear match Continues automatically

Ambiguous Routes to human via Slack

Human decides

Agent resumes with decision

## Agent Capabilities

15 actions

### Databases

4

-   **Create Database** Creates a Cosmos DB database, for provisioning storage as part of environment setup.
-   **Delete Database** Permanently deletes a database and everything in it.
-   **Get Database** Returns the metadata of one database.
-   **List Databases** Lists the databases in the account, for discovery.

### Containers

4

-   **Create Container** Creates a container with a defined hash partition key path.
-   **Delete Container** Permanently deletes a container and all of its documents.
-   **Get Container** Returns the metadata of one container, including its partition key definition.
-   **List Containers** Lists the containers in a database, for discovery.

### Documents

7

-   **Create Document** Creates a document in a container. The document's partition key value is required.
-   **Delete Document** Deletes a document by id and partition key value.
-   **Get Document** Fetches a document by id and partition key value.
-   **List Documents** Pages through a container's documents using continuation tokens.
-   **Query Documents** Runs a parameterized SQL query with cross-partition execution, so filtering on the partition key is not required.
-   **Replace Document** Replaces a document by id and partition key value with a new body.
-   **Upsert Document** Inserts a document, or replaces it if one with the same id already exists, to keep a container in sync with an external source.

## Frequently Asked Questions

### What can FlowRunner do with Azure Cosmos DB?

FlowRunner agents can run Create Database, Delete Database, and Get Database in Azure Cosmos DB, plus 12 more actions.

### Does connecting Azure Cosmos DB to FlowRunner require OAuth?

Azure Cosmos DB uses a custom authentication method to connect to FlowRunner.

### Can Azure Cosmos DB trigger a FlowRunner workflow automatically?

Azure Cosmos DB doesn't currently expose triggers in FlowRunner. It connects as an action step inside workflows started by another trigger.

**Work at Azure Cosmos DB?** This integration exposes Azure Cosmos DB to AI agents on every FlowRunner plan, including through MCP, at no cost to you. [See what FlowRunner offers integration partners](https://flowrunner.ai/integrations/partners), including how to keep this page current.

---
Markdown version of https://flowrunner.ai/integrations/azure-cosmos-db. Site index: https://flowrunner.ai/llms.txt
