az sql midb short-term-retention-policy

Manage SQL Managed Instance database backup short term retention policy.

Commands

Name Description Type Status
az sql midb short-term-retention-policy set

Update short term retention for automated backups on a single database.

Core Preview
az sql midb short-term-retention-policy show

Show short term retention for automated backups on a single database.

Core Preview

az sql midb short-term-retention-policy set

Preview

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

Update short term retention for automated backups on a single database.

Locking backup immutability is irreversible and is supported only for live managed databases. Confirmation is required only when --lock-immutability is true; use --yes to skip it. Do not specify --lock-immutability with --deleted-time, even when false. Retention cannot be reduced on a dropped database whose backup immutability is locked.

az sql midb short-term-retention-policy set --retention-days
                                            [--acquire-policy-token]
                                            [--change-reference]
                                            [--deleted-time]
                                            [--ids]
                                            [--lock-immutability {false, true}]
                                            [--managed-instance --mi]
                                            [--name]
                                            [--no-wait]
                                            [--resource-group]
                                            [--subscription]
                                            [--yes]

Examples

Set backup short term retention for live managed database.

az sql midb short-term-retention-policy set -g mygroup --mi myinstance -n mymanageddb --retention-days 7

Set backup short term retention for dropped managed database.

az sql midb short-term-retention-policy set -g mygroup --mi myinstance -n mymanageddb --deleted-time "2018-05-20T05:34:22" --retention-days 7

Lock backup immutability for a live managed database, skipping confirmation.

az sql midb short-term-retention-policy set --resource-group mygroup --mi myinstance --name mymanageddb --retention-days 7 --lock-immutability true --yes

Required Parameters

--retention-days

New backup short term retention policy in days. Valid policy for live database is 7-35 days, valid policy for dropped databases is 0-35 days.

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--acquire-policy-token

Acquiring an Azure Policy token automatically for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--change-reference

The related change reference ID for this resource operation.

Property Value
Parameter group: Global Policy Arguments
--deleted-time

If specified, updates retention days for a deleted database, instead of an existing database. Must match the deleted time of a deleted database on the source Managed Instance.

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

Property Value
Parameter group: Resource Id Arguments
--lock-immutability

Whether to lock backup immutability for a live managed database. Locking is irreversible. Cannot be used with --deleted-time, even when false.

Property Value
Accepted values: false, true
--managed-instance --mi

Name of the Azure SQL Managed Instance.

Property Value
Parameter group: Resource Id Arguments
--name -n

The name of the Azure SQL Managed Database.

Property Value
Parameter group: Resource Id Arguments
--no-wait

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

Property Value
Default value: False
--resource-group -g

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

Property Value
Parameter group: Resource Id Arguments
--subscription

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

Property Value
Parameter group: Resource Id Arguments
--yes -y

Do not prompt for confirmation when locking backup immutability.

Property Value
Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

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

--verbose

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

Property Value
Default value: False

az sql midb short-term-retention-policy show

Preview

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

Show short term retention for automated backups on a single database.

The immutabilityStatus output property reports Disabled, Enabled or Locked for live and restorable dropped managed databases when returned by the service.

az sql midb short-term-retention-policy show [--deleted-time]
                                             [--ids]
                                             [--managed-instance --mi]
                                             [--name]
                                             [--resource-group]
                                             [--subscription]

Examples

Shows backup short term retention for live managed database.

az sql midb short-term-retention-policy show -g mygroup --mi myinstance -n mymanageddb

Show backup short term retention for dropped managed database.

az sql midb short-term-retention-policy show -g mygroup --mi myinstance -n mymanageddb --deleted-time "2018-05-20T05:34:22"

Optional Parameters

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--deleted-time

If specified, shows retention days for a deleted database, instead of an existing database.Must match the deleted time of a deleted database on the source Managed Instance.

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

Property Value
Parameter group: Resource Id Arguments
--managed-instance --mi

Name of the Azure SQL Managed Instance.

Property Value
Parameter group: Resource Id Arguments
--name -n

The name of the Azure SQL Managed Database.

Property Value
Parameter group: Resource Id Arguments
--resource-group -g

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

Property Value
Parameter group: Resource Id Arguments
--subscription

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

Property Value
Parameter group: Resource Id Arguments
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

Property Value
Default value: False
--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

Property Value
Default value: False
--output -o

Output format.

Property Value
Default value: json
Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
--query

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

--verbose

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

Property Value
Default value: False