Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New-CosmosDbAttachment -PartitionKey support #274

Closed
5 tasks
ghost opened this issue Feb 21, 2019 · 8 comments
Closed
5 tasks

New-CosmosDbAttachment -PartitionKey support #274

ghost opened this issue Feb 21, 2019 · 8 comments
Assignees
Labels
bug The issue is a bug. in progress The issue is being actively worked on by someone.

Comments

@ghost
Copy link

ghost commented Feb 21, 2019

Issue

New-CosmosDbAttachment does not support PartitionKey for latest API version, HTTP 400 without it.

  • Microsoft.Azure.Documents.Common/2.1.0.0
  • $PSVersionTable.PSVersion
Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      16299  820
  • Windows Powershell ISE
  • Windows 10 Enterprise
  • Get-Module -Name CosmosDB
ModuleType Version    Name                                ExportedCommands                                                                                                                
---------- -------    ----                                ----------------                                                                                                                
Script     3.1.0.293  CosmosDB                            {Get-CosmosDbAccount, Get-CosmosDbAccountConnectionString, Get-CosmosDbAccountMasterKey, Get-CosmosDbAttachment...} 
@PlagueHO PlagueHO added the bug The issue is a bug. label Feb 21, 2019
@PlagueHO PlagueHO self-assigned this Feb 21, 2019
@PlagueHO
Copy link
Owner

Thanks for raising this @ruipach - I'll get onto looking at this tonight

@PlagueHO PlagueHO added the in progress The issue is being actively worked on by someone. label Feb 22, 2019
@PlagueHO
Copy link
Owner

I have managed to replicate this now. Unfortunately the REST API documentation hasn't been updated yet, so I'm going to need to go blind on this one: https://docs.microsoft.com/en-us/rest/api/cosmos-db/create-an-attachment

@PlagueHO
Copy link
Owner

I've completed the support for this and I'll try and have this in the PS Gallery for you by tomorrow.

PlagueHO added a commit that referenced this issue Feb 22, 2019
Added support for PartitionKey in *-CosmosDBAttachment functions - Fixes #274
@ghost
Copy link
Author

ghost commented Feb 22, 2019

Hi Daniel
Sorry to bother you, just a warning about the documentation.
The SYNTAX Context(default) does not mention the PartitionKey support, shouldn't it?
Also, as a note, latest CosmosDB Add Collection makes this PartitionKey parameter mandatory, therefore the parameter is mandatory for all API requests.
image

@PlagueHO
Copy link
Owner

Hi @ruipach - no bother at all!

That is good info!

Could you clarify what you mean by the SYNTAX Context(default)?

The strange thing about the PartitionKey when creating a collection is that it doesn't seem to YET be mandatory (I have even got integration tests that validate this: https://github.com/PlagueHO/CosmosDB/blob/dev/test/Integration/CosmosDB.integration.Tests.ps1#L514). The REST API docs also refer to this as optional: https://docs.microsoft.com/en-us/rest/api/cosmos-db/create-a-collection

However, this might be a change that hasn't yet made it through all the docs. So I'll reach out to the CosmosDB team and point out the conflicting info and see if I can get them to clear it up one way or another.

If the PartitionKey does become mandatory I'd need to make a breaking change (which I hate doing). Using a default PartitionKey might be risky.

I'll raise a separate issue here in GH to track the issue.

@PlagueHO
Copy link
Owner

PlagueHO commented Feb 22, 2019

Hi @ruipach - I've done a bit more digging and it does look like PartitionKey will be required in the portal. It is mentioned that you can still create collections without PartitionKeys for now via the SDK (which uses the REST APIs like I do).

image

So I suspect this may become completely mandatory in future and I've raised an issue to track it:
#279

Finally: I've released the new version of CosmosDB to PSGallery:
https://www.powershellgallery.com/packages/CosmosDB/3.2.1.332

@ghost
Copy link
Author

ghost commented Feb 25, 2019

Hi Daniel,

I was mentioning the reference to [-PartitionKey <String[]>] in documentation:
https://github.com/PlagueHO/CosmosDB/wiki/New-CosmosDbAttachment#context-default

Thanks a lot!

@PlagueHO
Copy link
Owner

Ah right! Cool! I've updating the Wiki now so should be good to go 😁 I've asked the Cosmos DB team how they'd normally communicate change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug. in progress The issue is being actively worked on by someone.
Projects
None yet
Development

No branches or pull requests

1 participant