azure-logic-apps

Logic apps support of Hierarchical partition keys in Azure Cosmos DB


I am trying to create document into a container that has 2 level of Hierarchical partition keys set. Using logic apps "Create or update document (V3)" connector, I can see that request is failing as bad request. Same request copied from logic app run history and execute directly in Cosmos DB editor it works. Wondering if Logic apps support Hierarchical partition?

** "code": "BadRequest", "message": "Partition key provided either doesn't correspond to definition in the collection or doesn't match partition key field values specified in the document. **

Snippet of input being passed in Logic apps

{ "id": "3", "MID": "2", "MSGID": "300" }

Same works in the cosmos DB editor(Data Explorer). Note MID and MSGID are Hierarchical partition key


Solution

  • It looks like Create or update document (V3) action doesn't supports creation of document in the case of hierarchical partition key. But you can use Create or update item action which you can find below,

    enter image description here

    You can construct the request body in the same way like { "id": "3", "MID": "2", "MSGID": "300" } .

    enter image description here

    This works just fine.

    enter image description here