Share via


az sql midb ltr-policy

Manage SQL Managed Instance database long term retention policy.

Commands

Name Description Type Status
az sql midb ltr-policy set

Update long term retention settings for a managed database.

Core Preview
az sql midb ltr-policy show

Show the long term retention policy for a managed database.

Core Preview

az sql midb ltr-policy set

Preview

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

Update long term retention settings for a managed database.

az sql midb ltr-policy set [--ids]
                           [--managed-instance --mi]
                           [--monthly-retention]
                           [--name]
                           [--resource-group]
                           [--subscription]
                           [--week-of-year]
                           [--weekly-retention]
                           [--yearly-retention]

Examples

Set long term retention for a managed database.

az sql midb ltr-policy set -g mygroup --mi myinstance -n mymanageddb --weekly-retention "P1W" --monthly-retention "P6M" --yearly-retention "P1Y" --week-of-year 26

Optional Parameters

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

--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
--monthly-retention

Retention for the monthly backup. If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.There is a minimum of 7 days and a maximum of 10 years.

--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
--week-of-year

The Week of Year, 1 to 52, in which to take the yearly LTR backup.

--weekly-retention

Retention for the weekly backup. If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.There is a minimum of 7 days and a maximum of 10 years.

--yearly-retention

Retention for the yearly backup. If just a number is passed instead of an ISO 8601 string, days will be assumed as the units.There is a minimum of 7 days and a maximum of 10 years.

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 ltr-policy show

Preview

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

Show the long term retention policy for a managed database.

az sql midb ltr-policy show [--ids]
                            [--managed-instance --mi]
                            [--name]
                            [--resource-group]
                            [--subscription]

Examples

Show long term retention policy for a managed database.

az sql midb ltr-policy show -g mygroup --mi myinstance -n mymanageddb

Optional Parameters

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

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