2
votes

I'm trying to figure out how to specify a 10GB fixed size when creating a new Cosmos DB collection using the Azure CLI. The az cosmosdb collection create command does not let you specify that. Must be right in my face but I can't see how can I achieve this.

az cosmosdb collection create --collection-name
                          --db-name
                          [--default-ttl]
                          [--indexing-policy]
                          [--key]
                          [--name]
                          [--partition-key-path]
                          [--resource-group-name]
                          [--throughput]
                          [--url-connection]

Doc link: https://docs.microsoft.com/en-us/cli/azure/cosmosdb/collection?view=azure-cli-latest#az-cosmosdb-collection-create

2
Just a hack: Can you try by specifying a throughput value of 400 (minimum throughput allowed for a fixed size collection)? You can then update the collection later and set its value to anywhere between 400 and 2500 (maximum throughput allowed for a fixed size collection). - Gaurav Mantri
Hey Gaurav! Toan tried it and it creates a fixed size collection by default. Looks like the command does not support creating the unlimited type. I think the doc should be updated to reflect that. I'll try to ping the team on Twitter to see what they have to say. - CSharpRocks

2 Answers

1
votes

When using the CLI, you can create both fixed (10GB) and unlimited collections. The primary difference is whether you specify the partition key (and then specify throughput within the valid range for either fixed or unlimited collection). Partition key is required for unlimited collections.

For example, I just ran these two commands:

az cosmosdb collection create -d stackoverflow -c test1
--name <mycosmosaccountname> --key "<mycosmosaccountkey>"
--throughput 400

az cosmosdb collection create -d stackoverflow -c test2
--name <mycosmosaccountname> --key "<mycosmosaccountkey>"
--partition-key-path "/foo" --throughput 3000

This created both a 10GB collection and an unlimited collection:

example of collections via cli

0
votes

By default when you use the Azure CLI, the collection is created with a FIXED storage amout of 10Gb.

I ran this command

az cosmosdb collection create --collection-name "hither" --db-name "Lightning"  --name "toannsss"--db-name "Lightning" --resource-group-name "rsgroup" --name "toanns" --key "YourKey" --url-connection "https://toanns.documents.azure.com:443/"

Which created enter image description here

I don't think there is an option to create unlimited size collection yet from Azure CLI as at 22/07/2018