user793891
user793891

Reputation:

How to specify a 10GB fixed size when creating a new Cosmos DB collection using the Azure CLI

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://learn.microsoft.com/en-us/cli/azure/cosmosdb/collection?view=azure-cli-latest#az-cosmosdb-collection-create

Upvotes: 2

Views: 638

Answers (2)

David Makogon
David Makogon

Reputation: 71066

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

Upvotes: 1

Toan Nguyen
Toan Nguyen

Reputation: 11591

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

Upvotes: 0

Related Questions