You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before submitting your issue for the CosmosDB project, please take a moment to provide the following details:
[ 5.1.17134.228 ] Version of PowerShell you're using
[ Console ] PowerShell host you're using (eg. Console Host, ISE, Visual Studio)
[Windows 10 ] Operating system you're running
[ 2.1.5.548 ] Version of CosmosDB PowerShell Module you're using (use Get-Module -Name CosmosDB)
I only came across this by mimicking the behavior in the Azure portal, where it suggests a partition key of "/address/zipCode", so I tried entering in a partition key of "/Document/MyId" via: New-CosmosDBCollection -Context @ctx -PartitionKey "/Document/MyId" -Id Test
And I got the following response:
Invoke-WebRequest : The remote server returned an error: (400) Bad Request.
Digging deeper, I get:
"The partition key component definition path '\/\/Document\/MyId' could not be accepted, failed near position '1'. Partition key paths must contain only valid characters and not contain a trailing slash or wildcard character.
I only figured out what was actually going on by digging into the source here.
This seems like a simple change to only prepend "/" if the $PartitionKey does not already start with one.
I'd be happy to submit the fix myself if this is something useful to anyone besides me.
The text was updated successfully, but these errors were encountered:
Hi @ledbutter - great catch and thank you for submitting this. Definitely happy to accept a PR if you're happy to submit it! 😁 Otherwise I'll be doing some more work on this module later this week.
Before submitting your issue for the CosmosDB project, please take a moment to provide the following details:
Get-Module -Name CosmosDB
)I only came across this by mimicking the behavior in the Azure portal, where it suggests a partition key of "/address/zipCode", so I tried entering in a partition key of "/Document/MyId" via:
New-CosmosDBCollection -Context @ctx -PartitionKey "/Document/MyId" -Id Test
And I got the following response:
Digging deeper, I get:
I only figured out what was actually going on by digging into the source here.
This seems like a simple change to only prepend "/" if the
$PartitionKey
does not already start with one.I'd be happy to submit the fix myself if this is something useful to anyone besides me.
The text was updated successfully, but these errors were encountered: