Share via


az cosmosdb

Note

This reference is part of the cosmosdb-preview extension for the Azure CLI (version 2.17.1 or higher). The extension will automatically install the first time you run an az cosmosdb command. Learn more about extensions.

Manage Azure Cosmos DB database accounts.

Commands

Name Description Type Status
az cosmosdb copy

Manage container copy job.

Extension Preview
az cosmosdb copy cancel

Cancel a container copy job.

Extension Preview
az cosmosdb copy complete

Completes an online container copy job.

Extension Preview
az cosmosdb copy create

Creates a container copy job.

Extension Preview
az cosmosdb copy list

Get a container copy job.

Extension Preview
az cosmosdb copy pause

Pause a container copy job.

Extension Preview
az cosmosdb copy resume

Resume a container copy job.

Extension Preview
az cosmosdb copy show

Get a container copy job.

Extension Preview
az cosmosdb create

Creates a new Azure Cosmos DB database account.

Extension Preview
az cosmosdb dts

Manage data transfer job with cosmosdb.

Extension Preview and Deprecated
az cosmosdb dts cancel

Cancels a Data Transfer Job.

Extension Preview and Deprecated
az cosmosdb dts copy

Creates a Data Transfer Copy Job.

Extension Preview and Deprecated
az cosmosdb dts list

Get a list of Data Transfer Jobs.

Extension Preview and Deprecated
az cosmosdb dts pause

Pause a Data Transfer Job.

Extension Preview and Deprecated
az cosmosdb dts resume

Resumes a Data Transfer Job.

Extension Preview and Deprecated
az cosmosdb dts show

Get a Data Transfer Job.

Extension Preview and Deprecated
az cosmosdb gremlin

Manage Gremlin resources of Azure Cosmos DB account.

Extension GA
az cosmosdb gremlin database

Manage Azure Cosmos DB Gremlin databases.

Extension GA
az cosmosdb gremlin database restore

Restore a deleted gremlin database within the same account.

Extension Preview
az cosmosdb gremlin graph

Manage Azure Cosmos DB Gremlin graphs.

Extension GA
az cosmosdb gremlin graph restore

Restore a deleted gremlin graph within the same account.

Extension Preview
az cosmosdb gremlin restorable-database

Manage different versions of gremlin databases that are restorable in a Azure Cosmos DB account.

Extension Preview
az cosmosdb gremlin restorable-database list

List all the versions of all the gremlin databases that were created / modified / deleted in the given restorable account.

Extension Preview
az cosmosdb gremlin restorable-graph

Manage different versions of gremlin graphs that are restorable in a database of a Azure Cosmos DB account.

Extension Preview
az cosmosdb gremlin restorable-graph list

List all the versions of all the gremlin graphs that were created / modified / deleted in the given database and restorable account.

Extension Preview
az cosmosdb gremlin restorable-resource

Manage the databases and its graphs that can be restored in the given account at the given timestamp and region.

Extension Preview
az cosmosdb gremlin restorable-resource list

List all the databases and its graphs that can be restored in the given account at the given timestamp and region.

Extension Preview
az cosmosdb gremlin retrieve-latest-backup-time

Retrieves latest restorable timestamp for the given gremlin graph in given region.

Extension Preview
az cosmosdb list

List Azure Cosmos DB database accounts.

Extension GA
az cosmosdb mongocluster

Mongo cluster.

Extension Preview
az cosmosdb mongocluster create

Create a Mongo cluster.

Extension Preview
az cosmosdb mongocluster delete

Delete a Mongo Cluster Resource.

Extension Preview
az cosmosdb mongocluster firewall

Mongo cluster firewall.

Extension Preview
az cosmosdb mongocluster firewall rule

Mongo cluster firewall rule.

Extension Preview
az cosmosdb mongocluster firewall rule create

Create a Mongo cluster firewall rule.

Extension Preview
az cosmosdb mongocluster firewall rule delete

Delete a Mongo cluster firewall rule.

Extension Preview
az cosmosdb mongocluster firewall rule list

Lists firewall rule on a Mongo cluster.

Extension Preview
az cosmosdb mongocluster firewall rule show

Get a Mongo cluster firewall rule.

Extension Preview
az cosmosdb mongocluster firewall rule update

Create a Mongo cluster firewall rule.

Extension Preview
az cosmosdb mongocluster list

List a Mongo Cluster Resource.

Extension Preview
az cosmosdb mongocluster show

Get a Mongo Cluster Resource.

Extension Preview
az cosmosdb mongocluster update

Update a Mongo cluster.

Extension Preview
az cosmosdb mongodb

Manage MongoDB resources of Azure Cosmos DB account.

Extension GA
az cosmosdb mongodb collection

Manage Azure Cosmos DB MongoDB collections.

Extension GA
az cosmosdb mongodb collection merge

Merges the partitions of a mongodb collection.

Extension Preview
az cosmosdb mongodb collection redistribute-partition-throughput

Redistributes the partition throughput of a mongodb collection.

Extension Preview
az cosmosdb mongodb collection restore

Restore a deleted mongodb collection within the same account.

Extension Preview
az cosmosdb mongodb collection retrieve-partition-throughput

Retrieve the partition throughput of a mongodb collection.

Extension Preview
az cosmosdb mongodb database

Manage Azure Cosmos DB MongoDB databases.

Extension GA
az cosmosdb mongodb database merge

Merges the partitions of a mongodb database.

Extension Preview
az cosmosdb mongodb database restore

Restore a deleted mongodb database within the same account.

Extension Preview
az cosmosdb mongodb restorable-collection

Manage different versions of mongodb collections that are restorable in a database of a Azure Cosmos DB account.

Extension Preview
az cosmosdb mongodb restorable-collection list

List all the versions of all the mongodb collections that were created / modified / deleted in the given database and restorable account.

Extension Preview
az cosmosdb mongodb role

Manage Azure Cosmos DB Mongo role resources.

Extension GA
az cosmosdb mongodb role definition

Manage Azure Cosmos DB Mongo role definitions.

Extension GA
az cosmosdb mongodb role definition create

Create a Mongo DB role definition under an Azure Cosmos DB account.

Extension GA
az cosmosdb mongodb role definition delete

Delete a CosmosDb MongoDb role definition under an Azure Cosmos DB account.

Extension GA
az cosmosdb mongodb role definition exists

Check if an Azure Cosmos DB MongoDb role definition exists.

Extension GA
az cosmosdb mongodb role definition list

List all MongoDb role definitions under an Azure Cosmos DB account.

Extension GA
az cosmosdb mongodb role definition show

Show the properties of a MongoDb role definition under an Azure Cosmos DB account.

Extension GA
az cosmosdb mongodb role definition update

Update a MongoDb role definition under an Azure Cosmos DB account.

Extension GA
az cosmosdb mongodb user

Manage Azure Cosmos DB Mongo user resources.

Extension GA
az cosmosdb mongodb user definition

Manage Azure Cosmos DB Mongo user definitions.

Extension GA
az cosmosdb mongodb user definition create

Create a Mongo DB user definition under an Azure Cosmos DB account.

Extension GA
az cosmosdb mongodb user definition delete

Delete a CosmosDb MongoDb user definition under an Azure Cosmos DB account.

Extension GA
az cosmosdb mongodb user definition exists

Check if an Azure Cosmos DB MongoDb user definition exists.

Extension GA
az cosmosdb mongodb user definition list

List all MongoDb user definitions under an Azure Cosmos DB account.

Extension GA
az cosmosdb mongodb user definition show

Show the properties of a MongoDb user definition under an Azure Cosmos DB account.

Extension GA
az cosmosdb mongodb user definition update

Update a MongoDb user definition under an Azure Cosmos DB account.

Extension GA
az cosmosdb restorable-database-account

Manage restorable Azure Cosmos DB accounts.

Extension GA
az cosmosdb restorable-database-account list

List all the database accounts that can be restored.

Extension GA
az cosmosdb restorable-database-account show

Show the details of a database account that can be restored.

Extension GA
az cosmosdb restore

Create a new Azure Cosmos DB database account by restoring from an existing database account.

Extension Preview
az cosmosdb service

Commands to perform operations on Service.

Extension Preview
az cosmosdb service create

Create a cosmosdb service resource.

Extension Preview
az cosmosdb service delete

Delete the given cosmosdb service resource.

Extension Preview
az cosmosdb service list

List all cosmosdb service resource under an account.

Extension Preview
az cosmosdb service show

Get cosmosdb service resource under an account.

Extension Preview
az cosmosdb service update

Update a cosmosdb service resource.

Extension Preview
az cosmosdb show

Get the details of an Azure Cosmos DB database account.

Extension GA
az cosmosdb sql

Manage SQL resources of Azure Cosmos DB account.

Extension GA
az cosmosdb sql container

Manage Azure Cosmos DB SQL containers.

Extension GA
az cosmosdb sql container create

Create an SQL container under an Azure Cosmos DB SQL database.

Extension GA
az cosmosdb sql container merge

Merges the partitions of a sql container.

Extension Preview
az cosmosdb sql container redistribute-partition-throughput

Redistributes the partition throughput of a sql container.

Extension Preview
az cosmosdb sql container restore

Restore a deleted sql container within the same account.

Extension Preview
az cosmosdb sql container retrieve-partition-throughput

Retrieve the partition throughput of a sql container.

Extension Preview
az cosmosdb sql container update

Update an SQL container under an Azure Cosmos DB SQL database.

Extension GA
az cosmosdb sql database

Manage Azure Cosmos DB SQL databases.

Extension GA
az cosmosdb sql database merge

Merge the partitions of a sql database.

Extension Preview
az cosmosdb sql database restore

Restore a deleted sql database within the same account.

Extension Preview
az cosmosdb sql restorable-container

Manage different versions of sql containers that are restorable in a database of a Azure Cosmos DB account.

Extension Preview
az cosmosdb sql restorable-container list

List all the versions of all the sql containers that were created / modified / deleted in the given database and restorable account.

Extension Preview
az cosmosdb table

Manage Table resources of Azure Cosmos DB account.

Extension GA
az cosmosdb table restorable-resource

Manage the tables that can be restored in the given account at the given timestamp and region.

Extension Preview
az cosmosdb table restorable-resource list

List all the tables that can be restored in the given account at the given timestamp and region.

Extension Preview
az cosmosdb table restorable-table

Manage different versions of tables that are restorable in Azure Cosmos DB account.

Extension Preview
az cosmosdb table restorable-table list

List all the versions of all the tables that were created / modified / deleted in the given restorable account.

Extension Preview
az cosmosdb table restore

Restore a deleted table within the same account.

Extension Preview
az cosmosdb table retrieve-latest-backup-time

Retrieves latest restorable timestamp for the given table in given region.

Extension Preview
az cosmosdb update

Update an Azure Cosmos DB database account.

Extension GA

az cosmosdb create

Preview

This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Creates a new Azure Cosmos DB database account.

az cosmosdb create --name
                   --resource-group
                   [--analytical-storage-schema-type {FullFidelity, WellDefined}]
                   [--assign-identity]
                   [--backup-interval]
                   [--backup-policy-type {Continuous, Periodic}]
                   [--backup-redundancy {Geo, Local, Zone}]
                   [--backup-retention]
                   [--capabilities]
                   [--continuous-tier {Continuous30Days, Continuous7Days}]
                   [--databases-to-restore]
                   [--default-consistency-level {BoundedStaleness, ConsistentPrefix, Eventual, Session, Strong}]
                   [--default-identity]
                   [--default-priority-level {High, Low}]
                   [--disable-key-based-metadata-write-access {false, true}]
                   [--enable-analytical-storage {false, true}]
                   [--enable-automatic-failover {false, true}]
                   [--enable-burst-capacity {false, true}]
                   [--enable-free-tier {false, true}]
                   [--enable-materialized-views {false, true}]
                   [--enable-multiple-write-locations {false, true}]
                   [--enable-partition-merge {false, true}]
                   [--enable-pbe {false, true}]
                   [--enable-prpp-autoscale {false, true}]
                   [--enable-virtual-network {false, true}]
                   [--gremlin-databases-to-restore]
                   [--ip-range-filter]
                   [--is-restore-request {false, true}]
                   [--key-uri]
                   [--kind {GlobalDocumentDB, MongoDB, Parse}]
                   [--locations]
                   [--max-interval]
                   [--max-staleness-prefix]
                   [--network-acl-bypass {AzureServices, None}]
                   [--network-acl-bypass-resource-ids]
                   [--public-network-access {DISABLED, ENABLED, SECUREDBYPERIMETER}]
                   [--restore-source]
                   [--restore-timestamp]
                   [--server-version {3.2, 3.6, 4.0, 4.2}]
                   [--tables-to-restore]
                   [--tags]
                   [--virtual-network-rules]

Examples

DB database account. (autogenerated)

az cosmosdb create --name MyCosmosDBDatabaseAccount --resource-group MyResourceGroup --subscription MySubscription

Creates a new Azure Cosmos DB database account with two regions. UK South is zone redundant.

az cosmosdb create -n myaccount -g mygroup --locations regionName=eastus failoverPriority=0 isZoneRedundant=False --locations regionName=uksouth failoverPriority=1 isZoneRedundant=True --enable-multiple-write-locations --network-acl-bypass AzureServices --network-acl-bypass-resource-ids /subscriptions/subId/resourceGroups/rgName/providers/Microsoft.Synapse/workspaces/wsName

Create a new Azure Cosmos DB database account by restoring from an existing account in the given location

az cosmosdb create -n restoredaccount -g mygroup --is-restore-request true --restore-source /subscriptions/2296c272-5d55-40d9-bc05-4d56dc2d7588/providers/Microsoft.DocumentDB/locations/westus/restorableDatabaseAccounts/d056a4f8-044a-436f-80c8-cd3edbc94c68 --restore-timestamp 2020-07-13T16:03:41+0000 --locations regionName=westus failoverPriority=0 isZoneRedundant=False

Creates a new Azure Cosmos DB database account with materialized views and cassandra capability enabled.

az cosmosdb create --name MyCosmosDBDatabaseAccount --resource-group MyResourceGroup --enable-materialized-views true --capabilities EnableCassandra CassandraEnableMaterializedViews

Required Parameters

--name -n

Name of the Cosmos DB database account.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Optional Parameters

--analytical-storage-schema-type --as-schema

Schema type for analytical storage.

accepted values: FullFidelity, WellDefined
--assign-identity

Assign system or user assigned identities separated by spaces. Use '[system]' to refer system assigned identity.

--backup-interval

The frequency(in minutes) with which backups are taken (only for accounts with periodic mode backups).

--backup-policy-type

The type of backup policy of the account to create.

accepted values: Continuous, Periodic
--backup-redundancy

The redundancy type of the backup Storage account.

accepted values: Geo, Local, Zone
--backup-retention

The time(in hours) for which each backup is retained (only for accounts with periodic mode backups).

--capabilities

Set custom capabilities on the Cosmos DB database account.

--continuous-tier

The tier of Continuous backup.

accepted values: Continuous30Days, Continuous7Days
--databases-to-restore
Preview

Add a database and its collection names to restore.

Usage: --databases-to-restore name=DatabaseName collections=collection1 [collection2 ...].

--default-consistency-level

Default consistency level of the Cosmos DB database account.

accepted values: BoundedStaleness, ConsistentPrefix, Eventual, Session, Strong
--default-identity

The primary identity to access key vault in CMK related features. e.g. 'FirstPartyIdentity', 'SystemAssignedIdentity' and more.

--default-priority-level
Preview

Default Priority Level of Request if not specified.

accepted values: High, Low
--disable-key-based-metadata-write-access

Disable write operations on metadata resources (databases, containers, throughput) via account keys.

accepted values: false, true
--enable-analytical-storage

Flag to enable log storage on the account.

accepted values: false, true
--enable-automatic-failover

Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account.

accepted values: false, true
--enable-burst-capacity
Preview

Flag to enable burst capacity on the account.

accepted values: false, true
--enable-free-tier
Preview

If enabled the account is free-tier.

accepted values: false, true
--enable-materialized-views --enable-mv
Preview

Flag to enable MaterializedViews on the account.

accepted values: false, true
--enable-multiple-write-locations

Enable Multiple Write Locations.

accepted values: false, true
--enable-partition-merge

Flag to enable partition merge on the account.

accepted values: false, true
--enable-pbe --enable-priority-based-execution
Preview

Flag to enable priority based execution on the account.

accepted values: false, true
--enable-prpp-autoscale
Preview

Enable or disable PerRegionPerPartitionAutoscale.

accepted values: false, true
--enable-virtual-network

Enables virtual network on the Cosmos DB database account.

accepted values: false, true
--gremlin-databases-to-restore
Preview

Add a gremlin database and its graph names to restore.

Usage: --gremlin-databases-to-restore name=DatabaseName graphs=graph1 [graph2 ...].

--ip-range-filter

Firewall support. Specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IPs for a given database account. IP addresses/ranges must be comma-separated and must not contain any spaces.

--is-restore-request -r
Preview

Restore from an existing/deleted account.

accepted values: false, true
--key-uri

The URI of the key vault.

--kind

The type of Cosmos DB database account to create.

accepted values: GlobalDocumentDB, MongoDB, Parse
default value: GlobalDocumentDB
--locations

Add a location to the Cosmos DB database account.

Usage: --locations KEY=VALUE [KEY=VALUE ...] Required Keys: regionName, failoverPriority Optional Key: isZoneRedundant Default: single region account in the location of the specified resource group. Failover priority values are 0 for write regions and greater than 0 for read regions. A failover priority value must be unique and less than the total number of regions. Multiple locations can be specified by using more than one --locations argument.

--max-interval

When used with Bounded Staleness consistency, this value represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 1 - 100.

default value: 5
--max-staleness-prefix

When used with Bounded Staleness consistency, this value represents the number of stale requests tolerated. Accepted range for this value is 1 - 2,147,483,647.

default value: 100
--network-acl-bypass

Flag to enable or disable Network Acl Bypass.

accepted values: AzureServices, None
--network-acl-bypass-resource-ids -i

List of Resource Ids to allow Network Acl Bypass.

--public-network-access -p

Sets public network access in server to either Enabled, Disabled, or SecuredByPerimeter.

accepted values: DISABLED, ENABLED, SECUREDBYPERIMETER
--restore-source
Preview

The restorable-database-account Id of the source account from which the account has to be restored. Required if --is-restore-request is set to true.

--restore-timestamp
Preview

The timestamp to which the account has to be restored to. Required if --is-restore-request is set to true.

--server-version

Valid only for MongoDB accounts.

accepted values: 3.2, 3.6, 4.0, 4.2
--tables-to-restore
Preview

Add table names to restore.

Usage: --tables-to-restore tables=table1 [table2 ...].

--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.

--virtual-network-rules

ACL's for virtual network.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az cosmosdb list

List Azure Cosmos DB database accounts.

az cosmosdb list [--resource-group]

Optional Parameters

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az cosmosdb restore

Preview

This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Create a new Azure Cosmos DB database account by restoring from an existing database account.

az cosmosdb restore --account-name
                    --location
                    --resource-group
                    --restore-timestamp
                    --target-database-account-name
                    [--assign-identity]
                    [--databases-to-restore]
                    [--default-identity]
                    [--disable-ttl {false, true}]
                    [--gremlin-databases-to-restore]
                    [--public-network-access {DISABLED, ENABLED}]
                    [--source-backup-location]
                    [--tables-to-restore]

Examples

Create a new Azure Cosmos DB database account by restoring from an existing database account.

az cosmosdb restore --target-database-account-name MyRestoredCosmosDBDatabaseAccount --account-name MySourceAccount --restore-timestamp 2020-07-13T16:03:41+0000 -g MyResourceGroup --location westus

Create a new Azure Cosmos DB Sql or MongoDB database account by restoring only the selected databases and collections from an existing database account.

az cosmosdb restore -g MyResourceGroup --target-database-account-name MyRestoredCosmosDBDatabaseAccount --account-name MySourceAccount --restore-timestamp 2020-07-13T16:03:41+0000 --location westus --databases-to-restore name=MyDB1 collections=collection1 collection2 --databases-to-restore name=MyDB2 collections=collection3 collection4

Create a new Azure Cosmos DB Gremlin database account by restoring only the selected databases or graphs from an existing database account.

az cosmosdb restore -g MyResourceGroup --target-database-account-name MyRestoredCosmosDBDatabaseAccount --account-name MySourceAccount --restore-timestamp 2020-07-13T16:03:41+0000 --location westus --gremlin-databases-to-restore name=graphdb1 graphs=graph1 graph2

Create a new Azure Cosmos DB Table database account by restoring only the selected tables from an existing database account.

az cosmosdb restore -g MyResourceGroup --target-database-account-name MyRestoredCosmosDBDatabaseAccount --account-name MySourceAccount --restore-timestamp 2020-07-13T16:03:41+0000 --location westus --tables-to-restore table1,table2

Required Parameters

--account-name -a

Name of the source Cosmos DB database account for the restore.

--location -l

This is the write region of the restored account. This is also the location of the source account where its backups are located if source_backup_location is not provided.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--restore-timestamp -t

The timestamp to which the account has to be restored to.

--target-database-account-name -n

Name of the new target Cosmos DB database account after the restore.

Optional Parameters

--assign-identity

Assign system or user assigned identities separated by spaces. Use '[system]' to refer system assigned identity.

--databases-to-restore

Add a database and its collection names to restore.

Usage: --databases-to-restore name=DatabaseName collections=collection1 [collection2 ...] Multiple databases can be specified by using more than one --databases-to-restore argument.

--default-identity

The primary identity to access key vault in CMK related features. e.g. 'FirstPartyIdentity', 'SystemAssignedIdentity' and more.

--disable-ttl
Preview

Enable or disable restoring with ttl disabled.

accepted values: false, true
--gremlin-databases-to-restore
Preview

Add a gremlin database and its graph names to restore.

Usage: --gremlin-databases-to-restore name=DatabaseName graphs=graph1 [graph2 ...].

--public-network-access -p

Sets public network access in server to either Enabled or Disabled.

accepted values: DISABLED, ENABLED
--source-backup-location
Preview

This is the location of the source account where backups are located. Provide this value if the source and target are in different locations.

--tables-to-restore
Preview

Add table names to restore.

Usage: --tables-to-restore table1 [table2 ...].

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az cosmosdb show

Get the details of an Azure Cosmos DB database account.

az cosmosdb show [--ids]
                 [--name]
                 [--resource-group]
                 [--subscription]

Examples

Get the details of an Azure Cosmos DB database account. (autogenerated)

az cosmosdb show --name MyCosmosDBDatabaseAccount --resource-group MyResourceGroup

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the Cosmos DB database account.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az cosmosdb update

Update an Azure Cosmos DB database account.

az cosmosdb update [--analytical-storage-schema-type {FullFidelity, WellDefined}]
                   [--backup-interval]
                   [--backup-policy-type {Continuous, Periodic}]
                   [--backup-redundancy {Geo, Local, Zone}]
                   [--backup-retention]
                   [--capabilities]
                   [--continuous-tier {Continuous30Days, Continuous7Days}]
                   [--default-consistency-level {BoundedStaleness, ConsistentPrefix, Eventual, Session, Strong}]
                   [--default-identity]
                   [--default-priority-level {High, Low}]
                   [--disable-key-based-metadata-write-access {false, true}]
                   [--enable-analytical-storage {false, true}]
                   [--enable-automatic-failover {false, true}]
                   [--enable-burst-capacity {false, true}]
                   [--enable-materialized-views {false, true}]
                   [--enable-multiple-write-locations {false, true}]
                   [--enable-partition-merge {false, true}]
                   [--enable-pbe {false, true}]
                   [--enable-prpp-autoscale {false, true}]
                   [--enable-virtual-network {false, true}]
                   [--ids]
                   [--ip-range-filter]
                   [--locations]
                   [--max-interval]
                   [--max-staleness-prefix]
                   [--name]
                   [--network-acl-bypass {AzureServices, None}]
                   [--network-acl-bypass-resource-ids]
                   [--public-network-access {DISABLED, ENABLED, SECUREDBYPERIMETER}]
                   [--resource-group]
                   [--server-version {3.2, 3.6, 4.0, 4.2}]
                   [--subscription]
                   [--tags]
                   [--virtual-network-rules]

Examples

Update an Azure Cosmos DB database account. (autogenerated)

az cosmosdb update --capabilities EnableGremlin --name MyCosmosDBDatabaseAccount --resource-group MyResourceGroup

Update an Azure Cosmos DB database account to enable materialized views.

az cosmosdb update --name MyCosmosDBDatabaseAccount --resource-group MyResourceGroup --enable-materialized-views true

Optional Parameters

--analytical-storage-schema-type --as-schema

Schema type for analytical storage.

accepted values: FullFidelity, WellDefined
--backup-interval

The frequency(in minutes) with which backups are taken (only for accounts with periodic mode backups).

--backup-policy-type

The type of backup policy of the account to create.

accepted values: Continuous, Periodic
--backup-redundancy

The redundancy type of the backup Storage account.

accepted values: Geo, Local, Zone
--backup-retention

The time(in hours) for which each backup is retained (only for accounts with periodic mode backups).

--capabilities

Set custom capabilities on the Cosmos DB database account.

--continuous-tier

The tier of Continuous backup.

accepted values: Continuous30Days, Continuous7Days
--default-consistency-level

Default consistency level of the Cosmos DB database account.

accepted values: BoundedStaleness, ConsistentPrefix, Eventual, Session, Strong
--default-identity

The primary identity to access key vault in CMK related features. e.g. 'FirstPartyIdentity', 'SystemAssignedIdentity' and more.

--default-priority-level
Preview

Default Priority Level of Request if not specified.

accepted values: High, Low
--disable-key-based-metadata-write-access

Disable write operations on metadata resources (databases, containers, throughput) via account keys.

accepted values: false, true
--enable-analytical-storage

Flag to enable log storage on the account.

accepted values: false, true
--enable-automatic-failover

Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account.

accepted values: false, true
--enable-burst-capacity
Preview

Flag to enable burst capacity on the account.

accepted values: false, true
--enable-materialized-views --enable-mv
Preview

Flag to enable MaterializedViews on the account.

accepted values: false, true
--enable-multiple-write-locations

Enable Multiple Write Locations.

accepted values: false, true
--enable-partition-merge

Flag to enable partition merge on the account.

accepted values: false, true
--enable-pbe --enable-priority-based-execution
Preview

Flag to enable priority based execution on the account.

accepted values: false, true
--enable-prpp-autoscale
Preview

Enable or disable PerRegionPerPartitionAutoscale.

accepted values: false, true
--enable-virtual-network

Enables virtual network on the Cosmos DB database account.

accepted values: false, true
--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--ip-range-filter

Firewall support. Specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IPs for a given database account. IP addresses/ranges must be comma-separated and must not contain any spaces.

--locations

Add a location to the Cosmos DB database account.

Usage: --locations KEY=VALUE [KEY=VALUE ...] Required Keys: regionName, failoverPriority Optional Key: isZoneRedundant Default: single region account in the location of the specified resource group. Failover priority values are 0 for write regions and greater than 0 for read regions. A failover priority value must be unique and less than the total number of regions. Multiple locations can be specified by using more than one --locations argument.

--max-interval

When used with Bounded Staleness consistency, this value represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 1 - 100.

--max-staleness-prefix

When used with Bounded Staleness consistency, this value represents the number of stale requests tolerated. Accepted range for this value is 1 - 2,147,483,647.

--name -n

Name of the Cosmos DB database account.

--network-acl-bypass

Flag to enable or disable Network Acl Bypass.

accepted values: AzureServices, None
--network-acl-bypass-resource-ids -i

List of Resource Ids to allow Network Acl Bypass.

--public-network-access -p

Sets public network access in server to either Enabled, Disabled, or SecuredByPerimeter.

accepted values: DISABLED, ENABLED, SECUREDBYPERIMETER
--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--server-version

Valid only for MongoDB accounts.

accepted values: 3.2, 3.6, 4.0, 4.2
--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--tags

Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.

--virtual-network-rules

ACL's for virtual network.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

accepted values: json, jsonc, none, table, tsv, yaml, yamlc
default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.