Logic Apps and CosmosDB - Partition Key Troubles

David Leek 21 Reputation points

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".


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,982 questions
Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,533 questions
0 comments No comments
{count} votes

Accepted answer
  1. Samara Soucy - MSFT 5,051 Reputation points

    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.

    And then if I match the key value in Logic Apps to the "PartitionKey" property, it will throw the error:

    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