- Home
- Resources
- Integrations
- Azure Cosmos DB
Azure Cosmos DB n8n integrationAutomate Azure Cosmos DB with n8n.
Your Cosmos DB documents can reach the rest of your tools without a line of code. The Azure Cosmos DB n8n integration exposes 10 operations across 2 resources, containers and items, and one of them is a SQL query with typed parameters. It fits ops teams already running on Azure who want workflows on top.
Verified Trustpilot reviews · AI, automation & growth agency
What does the Azure Cosmos DB n8n integration actually do?
The Azure Cosmos DB n8n integration is a node shipped with n8n that talks to the Azure Cosmos DB API from inside a workflow. It carries 2 resources, Container and Item, and 10 operations between them: create or delete a container, read one or list them all, then create, read, update, delete and query the documents stored inside. Every call reuses a single saved credential, so the account name and key live in one place.
Start with the export. A Schedule Trigger fires at a fixed hour, item.getAll reads the documents of a container with Return All switched on, and the result lands in Google Sheets for the people who never open the Azure portal. Swap the destination for Airtable and the workflow barely changes.
Then the write-back. Something happens elsewhere, a form comes in, a row moves in Postgres, and item.create stores the resulting document in Cosmos DB with its partition key value already filled from the incoming item. When the document is already there, item.update replaces its contents instead of adding a second one.
The third one is the filtered alert. item.query runs a SQL query against a container, the matching documents come back, and a short message goes to Slack when there is something to say. This is where the node earns its place: the filter runs inside Cosmos DB, not in n8n, so the workflow handles a handful of documents instead of a full container.
The 10 operations below are what the node does. If a workflow needs a call that is not one of them, the HTTP Request node reaches any endpoint of the Azure Cosmos DB API and reuses the same credential through predefined authentication, so nothing has to be rebuilt from scratch.
Two things are worth knowing before the first run. Cosmos DB compares types strictly, so a filter on a number that receives a string parameter comes back with nothing, which is exactly what Query Parameters (JSON) is for. And the JSON parser cannot hold integers above 9007199254740991 with full precision, so very large numeric values can drift when they go through that field. If you are still sizing up the platform itself, the n8n review covers the rest.
How do you connect Azure Cosmos DB to n8n?
- 01
Open the Azure account first
Two things have to exist before n8n can talk to anything: an Azure subscription, and an Azure Cosmos DB account created under it. The node authenticates with an API Key credential, and that credential is built from values that only exist once the account is there. If someone else in the company owns the subscription, this is the step to hand over rather than work around.
- 02
Collect the account, the key and the database
The credential asks for three values. Account is the name of your Azure Cosmos DB account. Key is a key for that account: in the Azure portal, open your Cosmos DB and select Overview, then Keys. Either of the two account keys works, so there is no wrong one to pick. Database is the name of the database you want the workflow to connect to.
- 03
Save the credential once in n8n
In n8n, open the Credentials menu, create an Azure Cosmos DB credential, paste the three values and save. A credential is created once and reused everywhere: every later workflow picks it from the drop-down list on the node, and nothing is retyped. Then drop the Azure Cosmos DB node into a workflow, select the credential, and the Container fields start listing what is actually in the database.
What can the Azure Cosmos DB node do?
The Azure Cosmos DB node exposes 10 operations across 2 resources. For each one: the node as you configure it in n8n, the required fields, and our field notes.
| Resource | Create | Get | Get Many | Update | Delete | Execute Query |
|---|---|---|---|---|---|---|
| Container | ✓ | ✓ | ✓ | ✓ | ||
| Item | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Operations index
Container
4 operationsCreate container
container.createWhat you see in n8n
Notes & use cases
Adds a new container to the database named in the credential, ready to take documents.
Key parameters
- ID: the unique identifier of the new container, typed in directly; the field shows
Container1as an example. - Partition Key: a JSON value naming the document property Cosmos DB uses to spread data across partitions. Pick a property with a wide range of values so request volume spreads evenly.
- Indexing Policy, Max RU/s (for Autoscale) and Manual Throughput RU/s, in Additional Fields: the indexing policy, the autoscale maximum, and manual throughput in units of
100request units per second.
Delete container
container.deleteWhat you see in n8n
Notes & use cases
Drops a container from the database the credential points to. One field decides everything here, so the thinking goes into what fills it.
Key parameters
- Container: a resource locator for the container you want to delete, picked from the list in the node or passed as an ID, for instance
{{ $json.containerId }}coming from an earlier node.
Get container
container.getWhat you see in n8n
Notes & use cases
Retrieves a single container and returns its definition, without reading the documents inside it.
Key parameters
- Container: a resource locator for the container you want to retrieve, selected from the list or given as an ID.
- Simplify: leave it on for a simplified version of the response, turn it off when the workflow needs the raw data.
Get many containers
container.getAllWhat you see in n8n
Notes & use cases
Retrieves the list of containers in the database. Nothing is required: the operation runs on whatever the credential connects to.
Key parameters
- Return All: switched on, n8n follows the API pages and brings back every container; switched off, it stops at Limit.
- Limit: the maximum number of containers returned when Return All is off.
- Simplify: a simplified response by default, the raw data when you turn it off.
Item
6 operationsCreate item
item.createWhat you see in n8n
Notes & use cases
Writes a new document into a container. The document is passed as a whole, not as a list of mapped columns.
Key parameters
- Container: a resource locator for the container you want to use.
- Item Contents: the item contents as a JSON object. The hint in the node is worth reading: the item requires an ID, and a partition key value when a custom key is set on the container.
Delete item
item.deleteWhat you see in n8n
Notes & use cases
Deletes one existing document, identified inside its container.
Key parameters
- Container: a resource locator for the container you want to use.
- Item: a resource locator for the item to be deleted, selected from the list or passed as an identifier.
- Partition Key, in Additional Fields: only required if a custom partition key is set for the container.
Get item
item.getWhat you see in n8n
Notes & use cases
Pulls a single document out of a container and hands it to the next node.
Key parameters
- Container: a resource locator for the container you want to use.
- Item: a resource locator for the item you want to retrieve.
- Simplify: on for a simplified version of the response, off for the raw data.
- Partition Key, in Additional Fields: only required if a custom partition key is set for the container.
Get many items
item.getAllWhat you see in n8n
Notes & use cases
Reads the documents of a container in bulk and outputs them as items in the workflow.
Key parameters
- Container: a resource locator for the container you want to use.
- Return All: on, n8n pages through the API until every document is back; off, it stops at Limit.
- Limit: the maximum number of documents returned.
- Simplify: a simplified response, or the raw data when disabled.
Query items
item.queryWhat you see in n8n
Notes & use cases
Runs a NoSQL SQL query against a container and returns only the matching documents.
Key parameters
- Query: the SQL to execute. Placeholders
$1,$2,$3reference the query parameters, and n8n converts them to@Param1,@Param2,@Param3before sending, as inSELECT * FROM c WHERE c.status = $1 AND c.startDate = $2. - Options: Query Parameters, a comma separated list of values always sent as strings, such as
active,2024; Query Parameters (JSON), a JSON array that keeps native types, as in[1737062400000, "01234", true, null]. - Simplify: enabled by default, it strips the internal metadata fields whose names start with
_.
Update item
item.updateWhat you see in n8n
Notes & use cases
Replaces the contents of a document that already exists, in place.
Key parameters
- Container: a resource locator for the container you want to use.
- Item: a resource locator for the item to be updated.
- Item Contents: the new item contents as a JSON object.
- Partition Key, in Additional Fields: only required if a custom partition key is set for the container.
Need help automating Azure Cosmos DB with n8n?
A person reads every message.
