How do I specify MongoDB API version when Creating Cosmos DB account running the az cosmosdb create command?

Viewed 293

Currently I have a shell script that has to Create a Cosmos DB account for MongoDB API in an existing resource group in an Azure project.

Bellow is the code snippet that does precisely that

az cosmosdb create \
    -n $accountName \
    -g $resourceGroupName \
    --kind MongoDB \
    --default-consistency-level Eventual \
    --locations regionName='West Europe' failoverPriority=0 isZoneRedundant=False \
    --locations regionName='East US' failoverPriority=1 isZoneRedundant=False

However this generates a Server Version 3.2 by default.

generates a Server Version 3.2 by default

My goal is to replicate in an "az" command the following behavior from the UI where I manually generate a Version 3.6, resulting in successful reading of version 3.6

Do you know what I should change within that code snippet to have it creating directly a wire protocol 3.6 CosmosDB account?

Thanks! Mihai

1 Answers

Just add --capabilities EnableMongo and it will create an account targeting MongoDB version 3.6.

So your command would be:

az cosmosdb create \
    -n $accountName \
    -g $resourceGroupName \
    --kind MongoDB \
    --default-consistency-level Eventual \
    --locations regionName='West Europe' failoverPriority=0 isZoneRedundant=False \
    --locations regionName='East US' failoverPriority=1 isZoneRedundant=False \
    --capabilities name=EnableMongo

enter image description here

Related