Create an Azure Cosmos DB account running the following command
az cosmosdb create --resource-group {RESOURCE_GROUP} --name {COSMOS_NAME}
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)
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)
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}
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