Azure-cli: How to set unique keys using the CLI when creating a collection ?

Created on 25 Apr 2018  Â·  6Comments  Â·  Source: Azure/azure-cli

When using the Azure portal to create a DocumentDB Collections you can add a unique key, how can yo do that using the Azure cli ?


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Service Attention question

Most helpful comment

@tjprescott please assign the data plane issues (including this one) to @christopheranderson

All 6 comments

I'm also interested in the answer to this question. It doesn't appear that there is a way to automate the process of creating unique keys.

+1 unique keys

So it seems that this is still not possible. Any plan to add this?

Any update on this?

The only way i can find outside of the portal is making a call direct to the api.

Ideally i'd like a way to do this via powershell or az cli.

@tjprescott please assign the data plane issues (including this one) to @christopheranderson

Hi all, right now it is not possible to add unique keys when creating a collection via the CLI. We do not plan on adding this functionality to the CLI at this time. You can use one of our other SDKs to create the unique keys right now.

We recently added support to perform this operation through our resource provider. You can make direct request with the uniqueKeyPolicy in the body. You can also use the azure-mgmt-cosmosdb python package, which allows you to specify this policy when creating a collection.

Was this page helpful?
0 / 5 - 0 ratings