az cosmosdb sql database

Note

This command group has commands that are defined in both Azure CLI and at least one extension. Install each extension to benefit from its extended capabilities. Learn more about extensions.

Manage Azure Cosmos DB SQL databases.

Commands

Name Description Type Status
az cosmosdb sql database create

Create an SQL database under an Azure Cosmos DB account.

Core GA
az cosmosdb sql database delete

Delete the SQL database under an Azure Cosmos DB account.

Core GA
az cosmosdb sql database exists

Checks if an Azure Cosmos DB SQL database exists.

Core GA
az cosmosdb sql database list

List the SQL databases under an Azure Cosmos DB account.

Core 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.

Core GA
az cosmosdb sql database restore (cosmosdb-preview extension)

Restore a deleted sql database within the same account.

Extension Preview
az cosmosdb sql database show

Show the details of a SQL database under an Azure Cosmos DB account.

Core GA
az cosmosdb sql database throughput

Manage throughput of SQL database under an Azure Cosmos DB account.

Core GA
az cosmosdb sql database throughput migrate

Migrate the throughput of the SQL database between autoscale and manually provisioned.

Core GA
az cosmosdb sql database throughput show

Get the throughput of the SQL database under an Azure Cosmos DB account.

Core GA
az cosmosdb sql database throughput update

Update the throughput of the SQL database under an Azure Cosmos DB account.

Core GA

az cosmosdb sql database create

Create an SQL database under an Azure Cosmos DB account.

az cosmosdb sql database create --account-name
                                --name
                                --resource-group
                                [--max-throughput]
                                [--throughput]

Required Parameters

--account-name -a

Cosmosdb account name.

--name -n

Database name.

--resource-group -g

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

Optional Parameters

--max-throughput

The maximum throughput resource can scale to (RU/s). Provided when the resource is autoscale enabled. The minimum value can be 4000 (RU/s).

--throughput

The throughput of SQL database (RU/s). Default value is 400.

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 sql database delete

Delete the SQL database under an Azure Cosmos DB account.

az cosmosdb sql database delete --account-name
                                --name
                                --resource-group
                                [--yes]

Required Parameters

--account-name -a

Cosmosdb account name.

--name -n

Database name.

--resource-group -g

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

Optional Parameters

--yes -y

Do not prompt for confirmation.

default value: False
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 sql database exists

Checks if an Azure Cosmos DB SQL database exists.

az cosmosdb sql database exists --account-name
                                --name
                                --resource-group

Required Parameters

--account-name -a

Cosmosdb account name.

--name -n

Database name.

--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 sql database list

List the SQL databases under an Azure Cosmos DB account.

az cosmosdb sql database list --account-name
                              --resource-group

Examples

List the SQL databases under an Azure Cosmos DB account (autogenerated)

az cosmosdb sql database list --account-name MyAccount --resource-group MyResourceGroup

Required Parameters

--account-name -a

Cosmosdb account name.

--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 sql database merge

Preview

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

Merge the partitions of a sql database.

az cosmosdb sql database merge --account-name
                               --name
                               --resource-group

Examples

Merge partitions of database my-database

az cosmosdb sql database merge -g my-resource-group -a my-account --name my-database

Required Parameters

--account-name -a

Name of the CosmosDB database account.

--name -n

Name of the CosmosDB database name.

--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 sql database restore

Restore a deleted sql database within the same account.

az cosmosdb sql database restore --account-name
                                 --name
                                 --resource-group
                                 [--restore-timestamp]

Examples

Restore a deleted sql database within the same account.

az cosmosdb sql database restore --resource-group resource_group --account-name database_account_name --name name_of_database_needs_to_be_restored --restore-timestamp 2020-07-13T16:03:41+0000

Required Parameters

--account-name -a

Cosmosdb account name.

--name -n

Database name.

--resource-group -g

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

Optional Parameters

--restore-timestamp -t

The timestamp to which the database needs to be restored to.

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 sql database restore (cosmosdb-preview extension)

Preview

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

Restore a deleted sql database within the same account.

az cosmosdb sql database restore --account-name
                                 --name
                                 --resource-group
                                 [--disable-ttl {false, true}]
                                 [--restore-timestamp]

Examples

Restore a deleted sql database within the same account.

az cosmosdb sql database restore --resource-group resource_group --account-name database_account_name --name name_of_database_needs_to_be_restored --restore-timestamp 2020-07-13T16:03:41+0000

Required Parameters

--account-name -a

Cosmosdb account name.

--name -n

Database name.

--resource-group -g

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

Optional Parameters

--disable-ttl
Preview

Enable or disable restoring with ttl disabled.

accepted values: false, true
--restore-timestamp -t

The timestamp to which the database needs to be restored to.

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 sql database show

Show the details of a SQL database under an Azure Cosmos DB account.

az cosmosdb sql database show --account-name
                              --name
                              --resource-group

Required Parameters

--account-name -a

Cosmosdb account name.

--name -n

Database name.

--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.