Azure Cosmos DB

Azure Cosmos DB

Azure Cosmos DB is a globally distributed multi-model database service designed to enable you to elastically and independently scale throughput and storage across any number of geographical regions with a comprehensive SLA.

This connector is available in the following products and regions:

Service Class Regions
Logic Apps Standard All Logic Apps regions
Flow Standard All Flow regions
PowerApps Standard All PowerApps regions

To use this integration, you will need a Cosmos DB SQL API account configured in the Azure Portal. Note that Mongo DB API accounts are not currently supported.

Once the SQL API account is created, provide the account ID (without 'documents.azure.com') when creating a connection with the Azure Cosmos DB connector.

Known Issues and Limitations

  • The maximum size of a document that is supported by the DocumentDB (Azure Cosmos DB) connector is 2 MB.
  • The Azure Cosmos DB limitations are documented here.
  • The "Partition key value" must be provided according to its type. For example string value must be placed between qoutes like "string value", but numeric value must be without them, like 123
  • The "Partition key value" is required for queries with ORDER BY, DISTINCT, etc, that run on partitioned collections.

Throttling Limits

Name Calls Renewal Period
API calls per connection 6000 60 seconds

Creating a connection

To connect your account, you will need the following information:

Account ID
string
Name of the account without 'documents.azure.com' part
Access Key to your Azure Cosmos DB account
securestring
Primary or Secondary Key

Actions

Create or update document

Create or update document.

Required Parameters

Database ID
string
The name of the database.
Collection ID
string
The name of the collection.

Optional Parameters

Partition key value
string
The partition key value for the requested document or attachment operation.
Max Item Count
number
An integer indicating the maximum number of items to be returned per page.
Continuation Token
string
A string token returned for queries and read-feed operations if there are more results to be read.
Consistency Level
string
This is the consistency level override. The valid values are: Strong, Bounded, Session, or Eventual (in order of strongest to weakest).
Session Token
string
A string token used with session level consistency.
Activity id
string
A client supplied identifier for the operation, which will be echoed in the server response.
IsUpsert
boolean
If set to true, the document will be replaced if it exists else created.
Pre-Trigger
string
Comma-separated list of trigger names to run before the document operation is executed.
Post-Trigger
string
Comma-separated list of trigger names to run after the document operation is executed.

Returns

Create stored procedure

Create stored procedure.

Required Parameters

Database ID
string
The name of the database.
Collection ID
string
The name of the collection.

Optional Parameters

Function definition
string
Function that defines the stored procedure, e.g. 'function(params){ ... }'
id
string
New id of the stored procedure.

Returns

Delete a document

Delete a document.

Required Parameters

Database ID
string
The name of the document.
Collection ID
string
The name of the collection.
Document ID
string
The identifier of the document.

Optional Parameters

Partition key value
string
The partition key value for the requested document or attachment operation.
Max Item Count
number
An integer indicating the maximum number of items to be returned per page.
Continuation Token
string
A string token returned for queries and read-feed operations if there are more results to be read.
Consistency Level
string
This is the consistency level override. The valid values are: Strong, Bounded, Session, or Eventual (in order of strongest to weakest).
Session Token
string
A string token used with session level consistency.
Activity id
string
A client supplied identifier for the operation, which will be echoed in the server response.
Pre-Trigger
string
Comma-separated list of trigger names to run before the document is deleted.
Post-Trigger
string
Comma-separated list of trigger names to run after the document id deleted.

Returns

Delete stored procedure

Delete stored procedure.

Required Parameters

Database ID
string
The name of the database.
Collection ID
string
The name of the collection.
Sproc ID
string
The name of the stored procedure.

Returns

Execute stored procedure

Execute stored procedure in specified collection.

Required Parameters

Database ID
string
The name of the database.
Collection ID
string
The name of the collection.
Sproc ID
string
The name of the stored procedure.

Optional Parameters

Partition key value
string
The partition key value for the requested document or attachment operation.
Parameters for the stored procedure
string
Specify valid JSON for the parameters of the stored procedure, e.g. ["param1", "param2"].

Returns

Get a document

Get a document.

Required Parameters

Database ID
string
The name of the database.
Collection ID
string
The name of the collection.
Document ID
string
The identifier for the document.

Optional Parameters

Partition key value
string
The partition key value for the requested document or attachment operation.
Max Item Count
number
An integer indicating the maximum number of items to be returned per page.
Continuation Token
string
A string token returned for queries and read-feed operations if there are more results to be read.
Consistency Level
string
This is the consistency level override. The valid values are: Strong, Bounded, Session, or Eventual (in order of strongest to weakest).
Session Token
string
A string token used with session level consistency.
Activity id
string
A client supplied identifier for the operation, which will be echoed in the server response.

Returns

Get all documents

Get all documents.

Required Parameters

Database ID
string
The name of the database.
Collection ID
string
The name of the collection.

Optional Parameters

Partition key value
string
The partition key value for the requested document or attachment operation.
Max Item Count
number
An integer indicating the maximum number of items to be returned per page.
Continuation Token
string
A string token returned for queries and read-feed operations if there are more results to be read.
Consistency Level
string
This is the consistency level override. The valid values are: Strong, Bounded, Session, or Eventual (in order of strongest to weakest).
Session Token
string
A string token used with session level consistency.
Activity id
string
A client supplied identifier for the operation, which will be echoed in the server response.

Returns

Get stored procedures

Get stored procedures in the specified collection.

Required Parameters

Database ID
string
The name of the database.
Collection ID
string
The name of the collection.

Returns

Query documents

Query documents.

Required Parameters

Database ID
string
The name of the database
Collection ID
string
The name of the collection.

Optional Parameters

Partition key value
string
The partition key value for the requested document or attachment operation.
Max Item Count
number
An integer indicating the maximum number of items to be returned per page.
Continuation Token
string
A string token returned for queries and read-feed operations if there are more results to be read.
Enable Cross Partition
boolean
If the collection is partitioned, this must be set to True to allow execution across multiple partitions.
Consistency Level
string
This is the consistency level override. The valid values are: Strong, Bounded, Session, or Eventual (in order of strongest to weakest).
Session Token
string
A string token used with session level consistency.
Activity id
string
A client supplied identifier for the operation, which will be echoed in the server response.
query
string

Returns

Replace a document

Replace a document.

Required Parameters

Database ID
string
The name of the database.
Collection ID
string
The name of the collection.
Document ID
string
The identifier of the document.

Optional Parameters

Partition key value
string
The partition key value for the requested document or attachment operation.
Max Item Count
number
An integer indicating the maximum number of items to be returned per page.
Continuation Token
string
A string token returned for queries and read-feed operations if there are more results to be read.
Consistency Level
string
This is the consistency level override. The valid values are: Strong, Bounded, Session, or Eventual (in order of strongest to weakest).
Session Token
string
A string token used with session level consistency.
Activity id
string
A client supplied identifier for the operation, which will be echoed in the server response.
Pre-Trigger
string
Comma-separated list of trigger names to run before replacing the document.
Post-Trigger
string
Comma-separated list of trigger names to run after replacing the document.

Returns

Replace stored procedure

Replace stored procedure.

Required Parameters

Database ID
string
The name of the database.
Collection ID
string
The name of the collection.
Sproc ID
string
The name of the stored procedure.

Optional Parameters

Function definition
string
Function that defines the stored procedure, e.g. 'function(params){ ... }'
id
string
Id of the existing stored procedure.

Returns

Definitions

postDocumentsResponse

_attachments
string
_etag
string
_rid
string
_self
string
_ts
integer
id
string

putDocumentResponse

_rid
string
id
string

getDocumentsResponse

Documents
array of object
_rid
string

queryResponse

Documents
array of
_count
number
_rid
string

getStoredProceduresResponse

StoredProcedures
array of object
StoredProcedures
_count
integer
_count
_etag
string
_etag
_rid
string
_rid
_rid
string
_rid
_self
string
_self
_ts
integer
_ts
body
string
body
id
string
id

createStoredProcedureResponse

_etag
string
_etag
_rid
string
_rid
_self
string
_self
_ts
integer
_ts
body
string
body
id
string
id