Share via


az sql db ltr-policy

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

Manage SQL database long term retention policy.

Commands

Name Description Type Status
az sql db ltr-policy set

Update long term retention settings for a database.

Core Preview
az sql db ltr-policy show

Show the long term retention policy for a database.

Core Preview

az sql db ltr-policy set

Preview

Command group 'sql db ltr-policy' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Update long term retention settings for a database.

az sql db ltr-policy set [--access-tier {Archive, Hot}]
                         [--ids]
                         [--make-backups-immutable {false, true}]
                         [--monthly-retention]
                         [--name]
                         [--resource-group]
                         [--server]
                         [--subscription]
                         [--week-of-year]
                         [--weekly-retention]
                         [--yearly-retention]

Examples

Set long term retention for a database.

az sql db ltr-policy set -g mygroup -s myserver -n mydb --weekly-retention "P1W" --monthly-retention "P6M" --yearly-retention "P1Y" --week-of-year 26 --access-tier "Archive" --make-backups-immutable true

Optional Parameters

--access-tier --backup-storage-access-tier

The access tier of a LTR backup.Possible values = [Hot, Archive].

Accepted values: Archive, Hot
--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.

--make-backups-immutable

Whether to make the LTR backups immutable.

Accepted values: false, true
--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

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.

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

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

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

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

--subscription

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

--verbose

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

az sql db ltr-policy show

Preview

Command group 'sql db ltr-policy' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

Show the long term retention policy for a database.

az sql db ltr-policy show [--ids]
                          [--name]
                          [--resource-group]
                          [--server]
                          [--subscription]

Examples

Show long term retention policy for a database.

az sql db ltr-policy show -g mygroup -s myserver -n mydb

Optional Parameters

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

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

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

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

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

--subscription

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

--verbose

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