az sql db ltr-backup

Manage SQL database long term retention backups.

Commands

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-backup delete

Delete a long term retention backup.

az sql db ltr-backup delete --database
                            --location
                            --name
                            --server
                            [--subscription]
                            [--yes]

Examples

Delete long term retention backup for database.

az sql db ltr-backup delete -l southeastasia -s myserver -d mydb -n "3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000"

Required Parameters

--database -d

Name of the Azure SQL Database. If specified (along with server name), retrieves all requested backups under this database.

--location -l

The location of the desired backups.

--name -n

The name of the LTR backup. Use 'az sql db ltr-backup show' or 'az sql db ltr-backup list' for backup name.

--server -s

Name of the Azure SQL Server. If specified, retrieves all requested backups under this server.

Optional Parameters

--subscription

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

--yes -y

Do not prompt for confirmation.

az sql db ltr-backup list

List the long term retention backups for a location, server or database.

az sql db ltr-backup list --location
                          [--database]
                          [--database-state]
                          [--latest]
                          [--query-examples]
                          [--resource-group]
                          [--server]
                          [--subscription]

Examples

List long term retention backups for a database.

az sql db ltr-backup list -l southeastasia -s myserver -d mydb

List long term retention backups for a server (list only the latest LTR backups, which belong to live databases).

az sql db ltr-backup list -l southeastasia -s myserver --database-state Live --only-latest-per-database True

List long term retention backups for a server (with resource group argument).

az sql db ltr-backup list -l southeastasia -g mygroup -s myserver

List long term retention backups for a location (list only the latest LTR backups, which belong to live databases).

az sql db ltr-backup list -l southeastasia --database-state Live --only-latest-per-database True

List long term retention backups for a location (with resource group argument).

az sql db ltr-backup list -l southeastasia -g mygroup

Required Parameters

--location -l

The location of the desired backups.

Optional Parameters

--database -d

Name of the Azure SQL Database. If specified (along with server name), retrieves all requested backups under this database.

--database-state --state

'All', 'Live', or 'Deleted'. Will fetch backups only from databases of specified state. If no state provied, defaults to 'All'.

--latest --only-latest-per-database

If true, will only return the latest backup for each database.

--query-examples

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.

--resource-group -g

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

--server -s

Name of the Azure SQL Server. If specified, retrieves all requested backups under this server.

--subscription

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

az sql db ltr-backup restore

Restore a long term retention backup to a new database.

az sql db ltr-backup restore --backup-id
                             --dest-database
                             --dest-resource-group
                             --dest-server
                             [--no-wait]
                             [--subscription]

Examples

Restore LTR backup.

az sql db ltr-backup restore \
--dest-database targetdb --dest-server myserver --dest-resource-group mygroup \
--backup-id "/subscriptions/6caa113c-794c-42f8-ab9d-878d8aa104dc/resourceGroups/mygroup/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionServers/myserver/longTermRetentionDatabases/sourcedb/longTermRetentionBackups/3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000"

Required Parameters

--backup-id

The resource id of the long term retention backup to be restored. Use 'az sql db ltr-backup show' or 'az sql db ltr-backup list' for backup id.

--dest-database

Name of the database that will be created as the restore destination.

--dest-resource-group

Name of the resource group of the server to restore database to.

--dest-server

Name of the server to restore database to.

Optional Parameters

--no-wait

Do not wait for the long-running operation to finish.

--subscription

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

az sql db ltr-backup show

Get a long term retention backup for a database.

az sql db ltr-backup show --database
                          --location
                          --name
                          --server
                          [--query-examples]
                          [--subscription]

Examples

Show long term retention backup for a database.

az sql db ltr-backup show -l southeastasia -s myserver -d mydb -n "3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000"

Required Parameters

--database -d

Name of the Azure SQL Database. If specified (along with server name), retrieves all requested backups under this database.

--location -l

The location of the desired backups.

--name -n

The name of the LTR backup. Use 'az sql db ltr-backup show' or 'az sql db ltr-backup list' for backup name.

--server -s

Name of the Azure SQL Server. If specified, retrieves all requested backups under this server.

Optional Parameters

--query-examples

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.

--subscription

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

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-backup wait [--created]
                          [--custom]
                          [--deleted]
                          [--exists]
                          [--ids]
                          [--interval]
                          [--name]
                          [--resource-group]
                          [--server]
                          [--subscription]
                          [--timeout]
                          [--updated]

Optional Parameters

--created

Wait until created with 'provisioningState' at 'Succeeded'.

--custom

Wait until the condition satisfies a custom JMESPath query. E.g. provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running'].

--deleted

Wait until deleted.

--exists

Wait until the resource exists.

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

--interval

Polling interval in seconds.

default value: 30
--name -n

Name of the Azure SQL Database.

--resource-group -g

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

--server -s

Name of the Azure SQL server. You can configure the default using az configure --defaults sql-server=<name>.

--subscription

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

--timeout

Maximum wait in seconds.

default value: 3600
--updated

Wait until updated with provisioningState at 'Succeeded'.