...see more

Create an Azure Cosmos DB account running the following command

az cosmosdb create --resource-group {RESOURCE_GROUP} --name {COSMOS_NAME}
...see more

Run the following command to store the Cosmos DB endpoint in an environment variable.

export ENDPOINT=$(az cosmosdb list --resource-group {RESOURCE_GROUP} --output tsv --query [0].documentEndpoint)
...see more

Run the following command to store the access key in an environment variable:

export KEY=$(az cosmosdb keys list --resource-group {RESOURCE_GROUP} --name {COSMOS_NAME} --output tsv --query primaryMasterKey)
...see more

Run the following command to create a database called in your Azure Cosmos DB account. 

az cosmosdb sql database create --resource-group {RESOURCE_GROUP} --account-name {COSMOS_NAME} --name {DATABASE_NAME}
...see more

Create a collection running the following command.

We use the id as the partition key and configure 100 request units per second (RU/s).

az cosmosdb sql container create --resource-group {RESOURCE_GROUP} --account-name {COSMOS_NAME} --database-name {DATABASE_NAME} --name {COLLECTION_NAME} --partition-key-path /id --throughput 100

Comments