Logic Apps and CosmosDB - Partition Key Troubles

David Leek 21 Reputation points
2020-06-17T16:09:14.903+00:00

Hello and thanks for reading!

I am trying to migrate from an Azure Table Storage instance to CosmosDB as the backing store for my logic app. The logic app is a webhook from Azure DevOps that records selected release information into a table. I've set up a Create or Update Document with proper connector. Right now I'm stuck on an error whereby regardless of how I massage the values I'm unable to get past "PartitionKey extracted from document doesn't match the one specified in the header".

10226-2020-06-17-10-54-02-logic-app-run-microsoft-azure.png

As you can see from the image, the values match. I've tried multiple iterations of this with different quotations, hard coding the values, going to the code view and pasting the same value in each key. Unfortunately, there is no way to determine the value the server thinks it is seeing, so the error message isn't terribly helpful.

Many of the answers I've found online reference making sure that the PartitionKey matches the one set for the collection, however this option doesn't appear anywhere in the current interface. So I'm stumped on how to proceed from here.

[As a side note, I'm not actually intending to use 'staging' as a partition value, I'm just reducing the complexity as far as possible to get it to work then trying to move up from there.]

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,964 questions
Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,520 questions
0 comments No comments
{count} votes

Accepted answer
  1. Samara Soucy - MSFT 5,051 Reputation points
    2020-06-25T21:30:14.94+00:00

    I can't tell for sure without knowing how your Cosmos container is setup, but my suspicion is that the partition key set in Cosmos is not the "PartitionKey" property.

    For example, I could set the partition key to the project Id in Cosmos.
    10723-2020-06-25-14-55-51-sasoucycosmos-data-explorer-mi.png

    And then if I match the key value in Logic Apps to the "PartitionKey" property, it will throw the error:
    10761-2020-06-25-17-25-48-logic-app-run-microsoft-azure.png

    If you've confirmed that the partition key in Cosmos matches the property, please let me know so I can investigate further.


0 additional answers

Sort by: Most helpful