PlagueHO / CosmosDB

PowerShell Module for working with Azure Cosmos DB databases, collections, documents, attachments, offers, users, permissions, triggers, stored procedures and user defined functions.
http://dscottraynsford.com
MIT License
154 stars 46 forks source link

Error 404 with get and set cosmosdbdocument #429

Closed jelleholtkamp closed 3 years ago

jelleholtkamp commented 3 years ago

Issue

I'm getting an error 404 when I try to get or set an exisiting CosmosDB document. The get command I'm submitting:

Get-CosmosDbDocument -Context $cosmosDbContext -CollectionId $CollectionId -Id "065a2cbf-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -PartitionKey 'id'

Set-CosmosDbDocument -Context $cosmosDbContext -CollectionId $CollectionId -Id "065a2cbf-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -DocumentBody $newDocument -PartitionKey "id"

image

Without supplying the PartitionKey value I get an error 400, but I believe that's to be expected. Am I missing something here?

PlagueHO commented 3 years ago

Hi @gekkegerrit101 ,

You need to specify the actual partition key value in the '-PartitionKey' parameter. E.g. the guid value from the Id in the document.

Does that fix the problem?

jelleholtkamp commented 3 years ago

Yes that works, thank you very much!