az sql midb ltr-backup

Manage SQL Managed Instance database long term retention backups.

Commands

az sql midb ltr-backup delete

Delete a long term retention backup.

az sql midb ltr-backup list

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

az sql midb ltr-backup restore

Restore a long term retention backup to a new database.

az sql midb ltr-backup show

Get a long term retention backup for a managed database.

az sql midb ltr-backup wait

Place the CLI in a waiting state until a condition of the managed database is met.

az sql midb ltr-backup delete

Delete a long term retention backup.

az sql midb ltr-backup delete [--backup-id]
                              [--database]
                              [--location]
                              [--managed-instance]
                              [--name]
                              [--subscription]
                              [--yes]

Examples

Delete long term retention backup for a managed database.

az sql midb ltr-backup delete -l southeastasia --mi myinstance -d mymanageddb --name "3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000"

Delete long term retention backup for a managed database.

az sql midb ltr-backup delete --backup-id '/subscriptions/6caa113c-794c-42f8-ab9d-878d8aa104dc/resourceGroups/mygroup/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/myinstance/longTermRetentionDatabases/mymanageddb/longTermRetentionManagedInstanceBackups/3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000'

Optional Parameters

--backup-id --id

The resource id of the backups. Use 'az sql midb ltr-backup show' or 'az sql midb ltr-backup list' for backup id. If provided, other arguments are not required.

--database -d

The name of the Azure SQL Managed Database.

--location -l

The location of the desired backup(s).

--managed-instance --mi

Name of the Azure SQL managed instance.

--name -n

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

--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 midb ltr-backup list

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

az sql midb ltr-backup list --location
                            [--database]
                            [--database-state]
                            [--latest]
                            [--managed-instance]
                            [--query-examples]
                            [--resource-group]
                            [--subscription]

Examples

List long term retention backups for a managed database.

az sql midb ltr-backup list -l southeastasia --mi myinstance -d mymanageddb

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

az sql midb ltr-backup list -l southeastasia --mi myinstance --database-state Live --only-latest-per-database

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

az sql midb ltr-backup list -l southeastasia -g mygroup --mi myinstance

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

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

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

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

Required Parameters

--location -l

The location of the desired backup(s).

Optional Parameters

--database -d

The name of the Azure SQL Managed Database. If specified (along with instance 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.

--managed-instance --mi

Name of the Azure SQL managed instance. If specified, retrieves all requested backups under this managed instance.

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

--subscription

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

az sql midb ltr-backup restore

Restore a long term retention backup to a new database.

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

Examples

Restore a managed database using LTR backup.

az sql midb ltr-backup restore \
    --dest-database targetmidb --dest-mi myinstance --dest-resource-group mygroup \
    --backup-id "/subscriptions/6caa113c-794c-42f8-ab9d-878d8aa104dc/resourceGroups/mygroup/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/myinstance/longTermRetentionDatabases/sourcemidb/longTermRetentionManagedInstanceBackups/3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000"

Required Parameters

--backup-id --id

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

--dest-database

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

--dest-mi

Name of the managed instance to restore managed database to.

--dest-resource-group

Name of the resource group of the managed instance to restore managed 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 midb ltr-backup show

Get a long term retention backup for a managed database.

az sql midb ltr-backup show [--backup-id]
                            [--database]
                            [--location]
                            [--managed-instance]
                            [--name]
                            [--query-examples]
                            [--subscription]

Examples

Show long term retention backup for a managed database.

az sql midb ltr-backup show --backup-id '/subscriptions/6caa113c-794c-42f8-ab9d-878d8aa104dc/resourceGroups/mygroup/providers/Microsoft.Sql/locations/southeastasia/longTermRetentionManagedInstances/myinstance/longTermRetentionDatabases/mymanageddb/longTermRetentionManagedInstanceBackups/3214b3fb-fba9-43e7-96a3-09e35ffcb336;132292152080000000'

Optional Parameters

--backup-id --id

The resource id of the backups. Use 'az sql midb ltr-backup show' or 'az sql midb ltr-backup list' for backup id. If provided, other arguments are not required.

--database -d

The name of the Azure SQL Managed Database.

--location -l

The location of the desired backup(s).

--managed-instance --mi

Name of the Azure SQL managed instance.

--name -n

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

--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 midb ltr-backup wait

Place the CLI in a waiting state until a condition of the managed database is met.

az sql midb ltr-backup wait --database
                            --managed-instance
                            --resource-group
                            [--created]
                            [--custom]
                            [--deleted]
                            [--exists]
                            [--interval]
                            [--subscription]
                            [--timeout]
                            [--updated]

Required Parameters

--database -d

The name of the Azure SQL Managed Database.

--managed-instance --mi

Name of the Azure SQL managed instance.

--resource-group -g

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

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.

--interval

Polling interval in seconds.

default value: 30
--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'.