Azure Logic Apps and CosmosDB
  • Updated on 02 May 2019
  • 1 minute to read
  • Contributors
  • Print
  • Comments
  • Share
  • Dark
    Light

Azure Logic Apps and CosmosDB

  • Print
  • Comments
  • Share
  • Dark
    Light

#ServerlessTips - Azure Logic Apps
Author: Steef-Jan Wiggers Azure MVP

With Logic Apps you can persist JSON document in Azure Cosmos DB, a globally distributed, multi-model cloud NoSQL database service. The persistence is done through the Cosmos DB connector, a standard connector, available in all Azure regions.

When communicating with a Cosmos DB instance, i.e. database – a collection you require the account id and collection id, both available when you configure the connection to a Cosmos DB instance (account).
Tip 24 - Azure Functions and CosmosDB Pic1.png

With the Cosmos DB connector, you can perform several actions ranging from creating or updating a document to calling a stored procedure. Furthermore, with each action, you can add one or more optional parameters. For instance, the create or update document has an optional parameter IsUpsert allowing you to override an existing document.

When interacting with documents in Cosmos DB you use unique identifier labelled id – every document within an Azure Cosmos DB database collection needs to have a unique identifier.

A potential use-case for persisting data in a Cosmos DB document collection can be log-data. The benefit of log-data in a Cosmos DB is that you integrate it with Azure Search. With Azure Search, you can index the document collection and do a full-text search and apply other search capabilities (scoring, ranking, facets, and sortings).

Was this article helpful?