Medium severitydata source
Power BI Refresh Error:
DF-Cosmos-InvalidPartitionKey
What does this error mean?
The ADF Mapping Data Flow Cosmos DB sink specifies a partition key path that does not match the actual partition key defined on the target container. Every write operation fails because Cosmos DB cannot route documents to the correct partition.
Common causes
- 1The partition key path in the Cosmos DB sink settings does not match the container's actual partition key (e.g., sink says '/customerId' but container uses '/tenantId')
- 2The partition key path format is incorrect — Cosmos DB requires a leading slash (e.g., '/category'), which may be missing in the sink configuration
- 3The container uses a nested partition key path (e.g., '/address/city') but the sink configuration only references the top-level property
How to fix it
- 1In the Azure portal, go to your Cosmos DB account → Data Explorer → select the target container → Scale & Settings and note the exact partition key path.
- 2Open the Cosmos DB sink transformation in ADF Studio and update the partition key path to match the container exactly, including the leading slash.
- 3Enable data flow Debug mode and preview the sink input to confirm the partition key column contains non-null values for every row.
- 4Re-run the pipeline after saving the corrected sink settings.
Frequently asked questions
Official documentation: https://learn.microsoft.com/en-us/azure/data-factory/data-flow-troubleshoot-guide