az sql db
Manage databases.
Commands
az sql db audit-policy |
Manage a database's auditing policy. |
az sql db audit-policy show |
Show database audit policy. |
az sql db audit-policy update |
Update a database's auditing policy. |
az sql db audit-policy wait |
Place the CLI in a waiting state until a condition of the database's audit policy is met. |
az sql db classification |
Manage sensitivity classifications. |
az sql db classification delete |
Delete the sensitivity classification of a given column. |
az sql db classification list |
Get the sensitivity classifications of a given database. |
az sql db classification recommendation |
Manage sensitivity classification recommendations. |
az sql db classification recommendation disable |
Disable sensitivity recommendations for a given column (recommendations are enabled by default on all columns). |
az sql db classification recommendation enable |
Enable sensitivity recommendations for a given column (recommendations are enabled by default on all columns). |
az sql db classification recommendation list |
List the recommended sensitivity classifications of a given database. |
az sql db classification show |
Get the sensitivity classification of a given column. |
az sql db classification update |
Update a columns's sensitivity classification. |
az sql db copy |
Create a copy of a database. |
az sql db create |
Create a database. |
az sql db delete |
Delete a database. |
az sql db export |
Export a database to a bacpac. |
az sql db import |
Imports a bacpac into an existing database. |
az sql db list |
List databases a server or elastic pool. |
az sql db list-deleted |
Gets a list of deleted databases that can be restored. |
az sql db list-editions |
Show database editions available for the currently active subscription. |
az sql db list-usages |
Returns database usages. |
az sql db ltr-backup |
Manage SQL database long term retention backups. |
az sql db ltr-backup delete |
Delete a long term retention backup. |
az sql db ltr-backup list |
List the long term retention backups for a location, server or database. |
az sql db ltr-backup restore |
Restore a long term retention backup to a new database. |
az sql db ltr-backup show |
Get a long term retention backup for a database. |
az sql db ltr-backup wait |
Place the CLI in a waiting state until a condition of the database is met. |
az sql db ltr-policy |
Manage SQL database long term retention policy. |
az sql db ltr-policy set |
Update long term retention settings for a database. |
az sql db ltr-policy show |
Show the long term retention policy for a database. |
az sql db op |
Manage operations on a database. |
az sql db op cancel |
Cancels the asynchronous operation on the database. |
az sql db op list |
Gets a list of operations performed on the database. |
az sql db rename |
Rename a database. |
az sql db replica |
Manage replication between databases. |
az sql db replica create |
Create a database as a readable secondary replica of an existing database. |
az sql db replica delete-link |
Permanently stop data replication between two database replicas. |
az sql db replica list-links |
List the replicas of a database and their replication status. |
az sql db replica set-primary |
Set the primary replica database by failing over from the current primary replica database. |
az sql db restore |
Create a new database by restoring from a backup. |
az sql db show |
Get the details for a database. |
az sql db show-connection-string |
Generates a connection string to a database. |
az sql db tde |
Manage a database's transparent data encryption. |
az sql db tde list-activity |
Returns a database's transparent data encryption operation result. |
az sql db tde set |
Sets a database's transparent data encryption configuration. |
az sql db tde show |
Gets a database's transparent data encryption configuration. |
az sql db threat-policy |
Manage a database's threat detection policies. |
az sql db threat-policy show |
Gets a database's threat detection policy. |
az sql db threat-policy update |
Update a database's threat detection policy. |
az sql db update |
Update a database. |
az sql db copy
Create a copy of a database.
A full list of performance level options can be seen by executing az sql db list-editions -a -o table -l LOCATION
. The copy destination database must have the same edition as the source database, but you can change the edition after the copy has completed.
az sql db copy --dest-name
[--auto-pause-delay]
[--backup-storage-redundancy]
[--capacity]
[--compute-model {Provisioned, Serverless}]
[--dest-resource-group]
[--dest-server]
[--elastic-pool]
[--family]
[--ha-replicas]
[--ids]
[--license-type {BasePrice, LicenseIncluded}]
[--min-capacity]
[--name]
[--no-wait]
[--read-scale {Disabled, Enabled}]
[--resource-group]
[--server]
[--service-objective]
[--subscription]
[--tags]
[--zone-redundant {false, true}]
Examples
Create a database with performance level S0 as a copy of an existing Standard database.
az sql db copy -g mygroup -s myserver -n originalDb --dest-name newDb --service-objective S0
Create a database with GeneralPurpose edition, Gen4 hardware, and 1 vcore as a copy of an existing GeneralPurpose database.
az sql db copy -g mygroup -s myserver -n originalDb --dest-name newDb -f Gen4 -c 1
Create a database with local backup storage redundancy as a copy of an existing database
az sql db copy -g mygroup -s myserver -n originalDb --dest-name newDb --backup-storage-redundancy Local
Required Parameters
Name of the database that will be created as the copy destination.
Optional Parameters
Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled.
Backup storage redundancy used to store backups. Allowed values include: Local, Zone, Geo.
The capacity component of the sku in integer number of DTUs or vcores.
The compute model of the database.
Name of the resouce group to create the copy in. If unspecified, defaults to the origin resource group.
Name of the server to create the copy in. If unspecified, defaults to the origin server.
The name or resource id of the elastic pool to create the database in.
The compute generation component of the sku (for vcore skus only). Allowed values include: Gen4, Gen5.
The number of high availability replicas to provision for the database. Only settable for Hyperscale edition.
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.
The license type to apply for this database. LicenseIncluded
if you need a license, or BasePrice
if you have a license and are eligible for the Azure Hybrid Benefit.
Minimal capacity that database will always have allocated, if not paused.
Name of the Azure SQL Database.
Do not wait for the long-running operation to finish.
If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica. This property is only settable for Premium and Business Critical databases.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name of the Azure SQL server. You can configure the default using az configure --defaults sql-server=<name>
.
The service objective for the new database. For example: Basic, S0, P1, GP_Gen4_1, GP_Gen5_S_8, BC_Gen5_2, HS_Gen5_32.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.
Specifies whether to enable zone redundancy.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az sql db create
Create a database.
A full list of performance level options can be seen by executing az sql db list-editions -a -o table -l LOCATION
.
az sql db create --name
--resource-group
--server
[--auto-pause-delay]
[--backup-storage-redundancy]
[--capacity]
[--catalog-collation {DATABASE_DEFAULT, SQL_Latin1_General_CP1_CI_AS}]
[--collation]
[--compute-model {Provisioned, Serverless}]
[--edition]
[--elastic-pool]
[--family]
[--ha-replicas]
[--license-type {BasePrice, LicenseIncluded}]
[--maint-config-id]
[--max-size]
[--min-capacity]
[--no-wait]
[--read-scale {Disabled, Enabled}]
[--sample-name {AdventureWorksLT}]
[--service-objective]
[--subscription]
[--tags]
[--yes]
[--zone-redundant {false, true}]
Examples
Create a Standard S0 database.
az sql db create -g mygroup -s myserver -n mydb --service-objective S0
Create a database with GeneralPurpose edition, Gen4 hardware and 1 vcore
az sql db create -g mygroup -s myserver -n mydb -e GeneralPurpose -f Gen4 -c 1
Create a database with zone redundancy enabled
az sql db create -g mygroup -s myserver -n mydb -z
Create a database with zone redundancy explicitly disabled
az sql db create -g mygroup -s myserver -n mydb -z false
Create a GeneralPurpose Gen5 2 vcore serverless database with auto pause delay of 120 minutes
az sql db create -g mygroup -s myserver -n mydb -e GeneralPurpose -f Gen5 -c 2 --compute-model Serverless --auto-pause-delay 120
Create a Hyperscale Gen5 2 vcore database with 2 read replicas
az sql db create -g mygroup -s myserver -n mydb -e Hyperscale -f Gen5 -c 2 --read-replicas 2
Create a GeneralPurpose database with locally redundant backup storage
az sql db create -g mygroup -s myserver -n mydb -e GeneralPurpose --backup-storage-redundancy Local
Required Parameters
Name of the Azure SQL Database.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name of the Azure SQL server. You can configure the default using az configure --defaults sql-server=<name>
.
Optional Parameters
Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled.
Backup storage redundancy used to store backups. Allowed values include: Local, Zone, Geo.
The capacity component of the sku in integer number of DTUs or vcores.
Collation of the metadata catalog.
The collation of the database.
The compute model of the database.
The edition component of the sku. Allowed values include: Basic, Standard, Premium, GeneralPurpose, BusinessCritical, Hyperscale.
The name or resource id of the elastic pool to create the database in.
The compute generation component of the sku (for vcore skus only). Allowed values include: Gen4, Gen5.
The number of high availability replicas to provision for the database. Only settable for Hyperscale edition.
The license type to apply for this database. LicenseIncluded
if you need a license, or BasePrice
if you have a license and are eligible for the Azure Hybrid Benefit.
Specified maintenance configuration id or name for this resource.
The max storage size. If no unit is specified, defaults to bytes (B).
Minimal capacity that database will always have allocated, if not paused.
Do not wait for the long-running operation to finish.
If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica. This property is only settable for Premium and Business Critical databases.
The name of the sample schema to apply when creating this database.
The service objective for the new database. For example: Basic, S0, P1, GP_Gen4_1, GP_Gen5_S_8, BC_Gen5_2, HS_Gen5_32.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.
Do not prompt for confirmation.
Specifies whether to enable zone redundancy.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az sql db delete
Delete a database.
az sql db delete [--ids]
[--name]
[--no-wait]
[--resource-group]
[--server]
[--subscription]
[--yes]
Examples
Delete a database. (autogenerated)
az sql db delete --name MyAzureSQLDatabase --resource-group MyResourceGroup --server myserver
Optional Parameters
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 of the Azure SQL Database.
Do not wait for the long-running operation to finish.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name of the Azure SQL server. You can configure the default using az configure --defaults sql-server=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Do not prompt for confirmation.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az sql db export
Export a database to a bacpac.
az sql db export --admin-password
--admin-user
--storage-key
--storage-key-type {SharedAccessKey, StorageAccessKey}
--storage-uri
[--auth-type {ADPassword, SQL}]
[--ids]
[--name]
[--resource-group]
[--server]
[--subscription]
Examples
Get an SAS key for use in export operation.
az storage blob generate-sas --account-name myAccountName -c myContainer -n myBacpac.bacpac \
--permissions w --expiry 2018-01-01T00:00:00Z
Export bacpac using an SAS key.
az sql db export -s myserver -n mydatabase -g mygroup -p password -u login \
--storage-key "?sr=b&sp=rw&se=2018-01-01T00%3A00%3A00Z&sig=mysignature&sv=2015-07-08" \
--storage-key-type SharedAccessKey \
--storage-uri https://myAccountName.blob.core.windows.net/myContainer/myBacpac.bacpac
Export bacpac using a storage account key.
az sql db export -s myserver -n mydatabase -g mygroup -p password -u login \
--storage-key MYKEY== --storage-key-type StorageAccessKey \
--storage-uri https://myAccountName.blob.core.windows.net/myContainer/myBacpac.bacpac
Required Parameters
Required. Administrator login password.
Required. Administrator login name.
Required. Storage key.
Required. Storage key type.
Required. Storage Uri.
Optional Parameters
Authentication type.
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 of the Azure SQL Database.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name of the Azure SQL server. You can configure the default using az configure --defaults sql-server=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az sql db import
Imports a bacpac into an existing database.
az sql db import --admin-password
--admin-user
--storage-key
--storage-key-type {SharedAccessKey, StorageAccessKey}
--storage-uri
[--auth-type {ADPassword, SQL}]
[--ids]
[--name]
[--resource-group]
[--server]
[--subscription]
Examples
Get an SAS key for use in import operation.
az storage blob generate-sas --account-name myAccountName -c myContainer -n myBacpac.bacpac \
--permissions r --expiry 2018-01-01T00:00:00Z
Import bacpac into an existing database using an SAS key.
az sql db import -s myserver -n mydatabase -g mygroup -p password -u login \
--storage-key "?sr=b&sp=rw&se=2018-01-01T00%3A00%3A00Z&sig=mysignature&sv=2015-07-08" \
--storage-key-type SharedAccessKey \
--storage-uri https://myAccountName.blob.core.windows.net/myContainer/myBacpac.bacpac
Import bacpac into an existing database using a storage account key.
az sql db import -s myserver -n mydatabase -g mygroup -p password -u login --storage-key MYKEY== \
--storage-key-type StorageAccessKey \
--storage-uri https://myAccountName.blob.core.windows.net/myContainer/myBacpac.bacpac
Required Parameters
Required. Administrator login password.
Required. Administrator login name.
Required. Storage key.
Required. Storage key type.
Required. Storage Uri.
Optional Parameters
Authentication type.
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 of the Azure SQL Database.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name of the Azure SQL server. You can configure the default using az configure --defaults sql-server=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az sql db list
List databases a server or elastic pool.
az sql db list [--elastic-pool]
[--ids]
[--query-examples]
[--resource-group]
[--server]
[--subscription]
Examples
List databases a server or elastic pool. (autogenerated)
az sql db list --resource-group MyResourceGroup --server myserver
Optional Parameters
If specified, lists only the databases in this elastic pool.
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.
Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name of the Azure SQL server. You can configure the default using az configure --defaults sql-server=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az sql db list-deleted
Gets a list of deleted databases that can be restored.
az sql db list-deleted [--ids]
[--resource-group]
[--server]
[--subscription]
Optional Parameters
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 of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name of the Azure SQL server. You can configure the default using az configure --defaults sql-server=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az sql db list-editions
Show database editions available for the currently active subscription.
Includes available service objectives and storage limits. In order to reduce verbosity, settings to intentionally reduce storage limits are hidden by default.
az sql db list-editions --location
[--available]
[--dtu]
[--edition]
[--service-objective]
[--show-details {max-size}]
[--subscription]
[--vcores]
Examples
Show all database editions in a location.
az sql db list-editions -l westus -o table
Show all available database service objectives for Standard edition.
az sql db list-editions -l westus --edition Standard -o table
Show available max database sizes for P1 service objective
az sql db list-editions -l westus --service-objective P1 --show-details max-size
Required Parameters
Location. Values from: az account list-locations
. You can configure the default location using az configure --defaults location=<location>
.
Optional Parameters
If specified, show only results that are available in the specified region.
Number of DTUs to search for. If unspecified, all DTU sizes are shown.
Edition to search for. If unspecified, all editions are shown.
Service objective to search for. If unspecified, all service objectives are shown.
List of additional details to include in output.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Number of vcores to search for. If unspecified, all vcore sizes are shown.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az sql db list-usages
Returns database usages.
az sql db list-usages [--ids]
[--name]
[--resource-group]
[--server]
[--subscription]
Optional Parameters
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 of the Azure SQL Database.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name of the Azure SQL server. You can configure the default using az configure --defaults sql-server=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az sql db rename
Rename a database.
az sql db rename --new-name
[--ids]
[--name]
[--resource-group]
[--server]
[--subscription]
Examples
Rename a database. (autogenerated)
az sql db rename --name MyAzureSQLDatabase --new-name MyNew --resource-group MyResourceGroup --server myserver
Required Parameters
The new name that the database will be renamed to.
Optional Parameters
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 of the Azure SQL Database.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name of the Azure SQL server. You can configure the default using az configure --defaults sql-server=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az sql db restore
Create a new database by restoring from a backup.
az sql db restore --dest-name
[--auto-pause-delay]
[--backup-storage-redundancy]
[--capacity]
[--compute-model {Provisioned, Serverless}]
[--deleted-time]
[--edition]
[--elastic-pool]
[--family]
[--ha-replicas]
[--ids]
[--license-type {BasePrice, LicenseIncluded}]
[--min-capacity]
[--name]
[--no-wait]
[--read-scale {Disabled, Enabled}]
[--resource-group]
[--server]
[--service-objective]
[--subscription]
[--tags]
[--time]
[--zone-redundant {false, true}]
Examples
Create a new database by restoring from a backup. (autogenerated)
az sql db restore --dest-name MyDest --edition GeneralPurpose --name MyAzureSQLDatabase --resource-group MyResourceGroup --server myserver --subscription MySubscription --time "2018-05-20T05:34:22"
Create a new database with geo-redundant backup storage by restoring from a backup. (autogenerated)
az sql db restore --dest-name MyDest --edition GeneralPurpose --name MyAzureSQLDatabase --resource-group MyResourceGroup --server myserver --subscription MySubscription --time "2018-05-20T05:34:22" --backup-storage-redundancy Geo
Required Parameters
Name of the database that will be created as the restore destination.
Optional Parameters
Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled.
Backup storage redundancy used to store backups. Allowed values include: Local, Zone, Geo.
The capacity component of the sku in integer number of DTUs or vcores.
The compute model of the database.
If specified, restore from a deleted database instead of from an existing database. Must match the deleted time of a deleted database in the same server. Either --time or --deleted-time (or both) must be specified. Time should be in following format: "YYYY-MM-DDTHH:MM:SS".
The edition component of the sku. Allowed values include: Basic, Standard, Premium, GeneralPurpose, BusinessCritical, Hyperscale.
The name or resource id of the elastic pool to create the database in.
The compute generation component of the sku (for vcore skus only). Allowed values include: Gen4, Gen5.
The number of high availability replicas to provision for the database. Only settable for Hyperscale edition.
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.
The license type to apply for this database. LicenseIncluded
if you need a license, or BasePrice
if you have a license and are eligible for the Azure Hybrid Benefit.
Minimal capacity that database will always have allocated, if not paused.
Name of the Azure SQL Database.
Do not wait for the long-running operation to finish.
If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica. This property is only settable for Premium and Business Critical databases.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name of the Azure SQL server. You can configure the default using az configure --defaults sql-server=<name>
.
The service objective for the new database. For example: Basic, S0, P1, GP_Gen4_1, GP_Gen5_S_8, BC_Gen5_2, HS_Gen5_32.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Space-separated tags: key[=value] [key[=value] ...]. Use "" to clear existing tags.
The point in time of the source database that will be restored to create the new database. Must be greater than or equal to the source database's earliestRestoreDate value. Either --time or --deleted-time (or both) must be specified. Time should be in following format: "YYYY-MM-DDTHH:MM:SS".
Specifies whether to enable zone redundancy.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az sql db show
Get the details for a database.
az sql db show [--ids]
[--name]
[--query-examples]
[--resource-group]
[--server]
[--subscription]
Examples
Get the details for a database. (autogenerated)
az sql db show --name MyAzureSQLDatabase --resource-group MyResourceGroup --server myserver
Optional Parameters
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 of the Azure SQL Database.
Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name of the Azure SQL server. You can configure the default using az configure --defaults sql-server=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az sql db show-connection-string
Generates a connection string to a database.
az sql db show-connection-string --client {ado.net, jdbc, odbc, php, php_pdo, sqlcmd}
[--auth-type {ADIntegrated, ADPassword, SqlPassword}]
[--ids]
[--name]
[--server]
[--subscription]
Examples
Generate connection string for ado.net
az sql db show-connection-string -s myserver -n mydb -c ado.net
Required Parameters
Type of client connection provider.
Optional Parameters
Type of authentication.
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 of the Azure SQL Database.
Name of the Azure SQL server. You can configure the default using az configure --defaults sql-server=<name>
.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.
az sql db update
Update a database.
az sql db update [--add]
[--auto-pause-delay]
[--backup-storage-redundancy]
[--capacity]
[--compute-model {Provisioned, Serverless}]
[--edition]
[--elastic-pool]
[--family]
[--force-string]
[--ha-replicas]
[--ids]
[--maint-config-id]
[--max-size]
[--min-capacity]
[--name]
[--no-wait]
[--read-scale {Disabled, Enabled}]
[--remove]
[--resource-group]
[--server]
[--service-objective]
[--set]
[--subscription]
[--zone-redundant {false, true}]
Examples
Update a database to Standard edition, S0 performance level (10 DTU) by specifying DTU capacity. Note that GeneralPurpose allows a wider range of max size than Standard edition.
az sql db update -g mygroup -s myserver -n mydb --edition Standard --capacity 10 --max-size 250GB
Update a database to Standard edition, S1 performance level (20 DTU) by specifying performance level name. Note that GeneralPurpose allows a wider range of max size than Standard edition.
az sql db update -g mygroup -s myserver -n mydb --edition Standard --service-objective S1 --max-size 250GB
Update a database to GeneralPurpose edition, 4 vcores with Gen5 hardware
az sql db update -g mygroup -s myserver -n mydb --edition GeneralPurpose --capacity 4 --family Gen5
Update database with increased max size
az sql db update -g mygroup -s myserver -n mydb --max-size 500GB
Update database with zone redundancy enabled
az sql db update -g mygroup -s myserver -n mydb -z
Update database with zone redundancy explicitly disabled
az sql db update -g mygroup -s myserver -n mydb -z false
Update database to serverless compute model
az sql db update -g mygroup -s myserver -n mydb --edition GeneralPurpose --capacity 2 --family Gen5 --compute-model Serverless
Update database with locally redundant backup storage
az sql db update -g mygroup -s myserver -n mydb --backup-storage-redundancy Local
Optional Parameters
Add an object to a list of objects by specifying a path and key value pairs. Example: --add property.listProperty <key=value, string or JSON string>.
Time in minutes after which database is automatically paused. A value of -1 means that automatic pause is disabled.
Backup storage redundancy used to store backups. Allowed values include: Local, Zone, Geo.
The capacity component of the sku in integer number of DTUs or vcores.
The compute model of the database.
The edition component of the sku. Allowed values include: Basic, Standard, Premium, GeneralPurpose, BusinessCritical, Hyperscale.
The name or resource id of the elastic pool to move the database into.
The compute generation component of the sku (for vcore skus only). Allowed values include: Gen4, Gen5.
When using 'set' or 'add', preserve string literals instead of attempting to convert to JSON.
The number of high availability replicas to provision for the database. Only settable for Hyperscale edition.
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.
Specified maintenance configuration id or name for this resource.
The new maximum size of the database expressed in bytes.
Minimal capacity that database will always have allocated, if not paused.
Name of the Azure SQL Database.
Do not wait for the long-running operation to finish.
If enabled, connections that have application intent set to readonly in their connection string may be routed to a readonly secondary replica. This property is only settable for Premium and Business Critical databases.
Remove a property or an element from a list. Example: --remove property.list OR --remove propertyToRemove.
Name of resource group. You can configure the default group using az configure --defaults group=<name>
.
Name of the Azure SQL server. You can configure the default using az configure --defaults sql-server=<name>
.
The name of the new service objective. If this is a standalone db service objective and the db is currently in an elastic pool, then the db is removed from the pool.
Update an object by specifying a property path and value to set. Example: --set property1.property2=.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID
.
Specifies whether to enable zone redundancy.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Increase logging verbosity. Use --debug for full debug logs.