Share via


az dataprotection backup-policy retention-rule

Note

This reference is part of the dataprotection extension for the Azure CLI (version 2.57.0 or higher). The extension will automatically install the first time you run an az dataprotection backup-policy retention-rule command. Learn more about extensions.

Create lifecycles and add or remove retention rules in a backup policy.

Commands

Name Description Type Status
az dataprotection backup-policy retention-rule create-lifecycle

Create lifecycle for Azure Retention rule.

Extension GA
az dataprotection backup-policy retention-rule remove

Remove existing retention rule in a backup policy.

Extension GA
az dataprotection backup-policy retention-rule set

Add new retention rule or update existing retention rule.

Extension GA

az dataprotection backup-policy retention-rule create-lifecycle

Create lifecycle for Azure Retention rule.

az dataprotection backup-policy retention-rule create-lifecycle --count
                                                                --retention-duration-type {Days, Months, Weeks, Years}
                                                                --source-datastore {ArchiveStore, OperationalStore, VaultStore}
                                                                [--copy-option {CopyOnExpiryOption, CustomCopyOption, ImmediateCopyOption}]
                                                                [--target-datastore {ArchiveStore, OperationalStore, VaultStore}]

Examples

create daily lifecycle

az dataprotection backup-policy retention-rule create-lifecycle --retention-duration-count 12 --retention-duration-type Days --source-datastore OperationalStore

Required Parameters

--count --retention-duration-count

Retention duration count.

--retention-duration-type --type

Retention duration type.

Accepted values: Days, Months, Weeks, Years
--source-datastore

Specify source datastore.

Accepted values: ArchiveStore, OperationalStore, VaultStore

Optional Parameters

--copy-option

Specify copy option from source datastore to target datastore.

Accepted values: CopyOnExpiryOption, CustomCopyOption, ImmediateCopyOption
--target-datastore

Specify target datastore.

Accepted values: ArchiveStore, OperationalStore, VaultStore
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 dataprotection backup-policy retention-rule remove

Remove existing retention rule in a backup policy.

az dataprotection backup-policy retention-rule remove --name {Daily, Default, Monthly, Weekly, Yearly}
                                                      --policy

Examples

Remove retention rule

az dataprotection backup-policy retention-rule remove --name Daily --policy policy.json

Required Parameters

--name

Specify the retention rule name to be removed in policy.

Accepted values: Daily, Default, Monthly, Weekly, Yearly
--policy

Existing policy Json string or file.

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 dataprotection backup-policy retention-rule set

Add new retention rule or update existing retention rule.

az dataprotection backup-policy retention-rule set --lifecycles
                                                   --name {Daily, Default, Monthly, Weekly, Yearly}
                                                   --policy

Examples

Add daily retention rule

az dataprotection backup-policy retention-rule set --lifecycles dailylifecycle.json --name Daily --policy policy.json

Required Parameters

--lifecycles

Lifecycles to be associated with the retention rule. Specify space separated json file names.

--name

Specify the retention rule name to be edited in policy.

Accepted values: Daily, Default, Monthly, Weekly, Yearly
--policy

Policy Json string or file.

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.