Share via


az backup policy

A backup policy defines when you want to take a backup and for how long you would retain each backup copy.

Commands

Name Description Type Status
az backup policy create

Create a new policy for the given BackupManagementType and workloadType.

Core GA
az backup policy delete

Delete a backup policy which doesn't have any associated backup items.

Core GA
az backup policy get-default-for-vm

Get the default policy with default values to backup a VM.

Core GA
az backup policy list

List all policies for a Recovery services vault.

Core GA
az backup policy list-associated-items

List all items protected by a backup policy.

Core GA
az backup policy set

Update the existing policy with the provided details.

Core GA
az backup policy show

Show details of a particular policy.

Core GA

az backup policy create

Create a new policy for the given BackupManagementType and workloadType.

az backup policy create --backup-management-type {AzureIaasVM, AzureStorage, AzureWorkload}
                        --name
                        --policy
                        --resource-group
                        --vault-name
                        [--workload-type {AzureFileShare, MSSQL, SAPASE, SAPAseDatabase, SAPHANA, SAPHanaDBInstance, SAPHanaDatabase, SQLDataBase, VM}]

Examples

Create a new policy for the given BackupManagementType and workloadType.

az backup policy create --policy {policy} --resource-group MyResourceGroup --vault-name MyVault --name MyPolicy --backup-management-type AzureStorage

Required Parameters

--backup-management-type

Specify the backup management type. Define how Azure Backup manages the backup of entities within the ARM resource. For eg: AzureWorkloads refers to workloads installed within Azure VMs, AzureStorage refers to entities within Storage account. Required only if friendly name is used as Container name.

Property Value
Accepted values: AzureIaasVM, AzureStorage, AzureWorkload
--name -n

Name of the Policy.

--policy

JSON encoded policy definition. Use the show command with JSON output to obtain a policy object. Modify the values using a file editor and pass the object.

--resource-group -g

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

--vault-name -v

Name of the Recovery services vault.

Optional Parameters

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

--workload-type

Specify the type of applications within the Resource which should be discovered and protected by Azure Backup. 'MSSQL' and 'SQLDataBase' can be used interchangeably for SQL in Azure VM, as can 'SAPHANA' and 'SAPHanaDatabase' for SAP HANA in Azure VM.

Property Value
Accepted values: AzureFileShare, MSSQL, SAPASE, SAPAseDatabase, SAPHANA, SAPHanaDBInstance, SAPHanaDatabase, SQLDataBase, VM
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.

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

Property Value
Default value: False

az backup policy delete

Delete a backup policy which doesn't have any associated backup items.

az backup policy delete [--ids]
                        [--name]
                        [--resource-group]
                        [--subscription]
                        [--vault-name]

Examples

Before you can delete a Backup protection policy, the policy must not have any associated Backup items. To associate another policy with a Backup item, use the backup item set-policy command.

az backup policy delete --name MyBackupPolicy --resource-group MyResourceGroup --vault-name MyVault

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

Name of the backup policy. You can use the backup policy list command to get the name of a policy.

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
--vault-name -v

Name of the Recovery services vault.

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

az backup policy get-default-for-vm

Get the default policy with default values to backup a VM.

az backup policy get-default-for-vm --resource-group
                                    --vault-name

Examples

Get the default policy with default values to backup a VM. (autogenerated)

az backup policy get-default-for-vm --resource-group MyResourceGroup --vault-name MyVault

Required Parameters

--resource-group -g

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

--vault-name -v

Name of the Recovery services vault.

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.

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

Property Value
Default value: False

az backup policy list

List all policies for a Recovery services vault.

az backup policy list --resource-group
                      --vault-name
                      [--backup-management-type {AzureIaasVM, AzureStorage, AzureWorkload}]
                      [--move-to-archive-tier {All, Disabled, Enabled}]
                      [--policy-sub-type {Enhanced, Standard}]
                      [--workload-type {AzureFileShare, MSSQL, SAPASE, SAPAseDatabase, SAPHANA, SAPHanaDBInstance, SAPHanaDatabase, SQLDataBase, VM}]

Examples

List all policies for a Recovery services vault. (autogenerated)

az backup policy list --resource-group MyResourceGroup --vault-name MyVault

Required Parameters

--resource-group -g

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

--vault-name -v

Name of the Recovery services vault.

Optional Parameters

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

--backup-management-type

Specify the backup management type. Define how Azure Backup manages the backup of entities within the ARM resource. For eg: AzureWorkloads refers to workloads installed within Azure VMs, AzureStorage refers to entities within Storage account. Required only if friendly name is used as Container name.

Property Value
Accepted values: AzureIaasVM, AzureStorage, AzureWorkload
--move-to-archive-tier

Parameter that specifies whether to only list policies where archive tier move is enabled/disabled.

Property Value
Default value: All
Accepted values: All, Disabled, Enabled
--policy-sub-type

Sub type of policies to be retrieved. To list standard backup policies, specify ‘Standard’ as the value of this parameter. To list enhanced backup policies for Azure VMs, specify ‘Enhanced’ as the value of this parameter.

Property Value
Accepted values: Enhanced, Standard
--workload-type

Specify the type of applications within the Resource which should be discovered and protected by Azure Backup. 'MSSQL' and 'SQLDataBase' can be used interchangeably for SQL in Azure VM, as can 'SAPHANA' and 'SAPHanaDatabase' for SAP HANA in Azure VM.

Property Value
Accepted values: AzureFileShare, MSSQL, SAPASE, SAPAseDatabase, SAPHANA, SAPHanaDBInstance, SAPHanaDatabase, SQLDataBase, VM
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.

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

Property Value
Default value: False

az backup policy list-associated-items

List all items protected by a backup policy.

az backup policy list-associated-items [--backup-management-type {AzureIaasVM, AzureStorage, AzureWorkload}]
                                       [--ids]
                                       [--name]
                                       [--resource-group]
                                       [--subscription]
                                       [--vault-name]

Examples

List all items protected by a backup policy

az backup policy list-associated-items --name MyBackupPolicy --resource-group MyResourceGroup --vault-name MyVault --backup-management-type AzureIaasVM

Optional Parameters

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

--backup-management-type

Specify the backup management type. Define how Azure Backup manages the backup of entities within the ARM resource. For eg: AzureWorkloads refers to workloads installed within Azure VMs, AzureStorage refers to entities within Storage account. Required only if friendly name is used as Container name.

Property Value
Accepted values: AzureIaasVM, AzureStorage, AzureWorkload
--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
--name -n

Name of the backup policy. You can use the backup policy list command to get the name of a policy.

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
--vault-name -v

Name of the Recovery services vault.

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

az backup policy set

Update the existing policy with the provided details.

az backup policy set [--backup-management-type {AzureIaasVM, AzureStorage, AzureWorkload}]
                     [--fix-for-inconsistent-items {false, true}]
                     [--ids]
                     [--name]
                     [--policy]
                     [--resource-group]
                     [--subscription]
                     [--tenant-id]
                     [--vault-name]
                     [--yes]

Examples

Update the existing policy with the provided details. (autogenerated)

az backup policy set --policy {policy} --resource-group MyResourceGroup --vault-name MyVault

Optional Parameters

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

--backup-management-type

Specify the backup management type. Define how Azure Backup manages the backup of entities within the ARM resource. For eg: AzureWorkloads refers to workloads installed within Azure VMs, AzureStorage refers to entities within Storage account. Required only if friendly name is used as Container name.

Property Value
Accepted values: AzureIaasVM, AzureStorage, AzureWorkload
--fix-for-inconsistent-items

Specify whether or not to retry Policy Update for failed items.

Property Value
Accepted values: false, true
--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
--name -n

Name of the Policy.

Property Value
Parameter group: Resource Id Arguments
--policy

JSON encoded policy definition. Use the show command with JSON output to obtain a policy object. Modify the values using a file editor and pass the object.

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

ID of the tenant if the Resource Guard protecting the vault exists in a different tenant.

--vault-name -v

Name of the Recovery services vault.

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

Skip confirmation when updating Standard to Enhanced Policies.

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

Show details of a particular policy.

az backup policy show [--ids]
                      [--name]
                      [--resource-group]
                      [--subscription]
                      [--vault-name]

Examples

Show details of a particular policy

az backup policy show --name MyBackupPolicy --resource-group MyResourceGroup --vault-name MyVault

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

Name of the backup policy. You can use the backup policy list command to get the name of a policy.

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
--vault-name -v

Name of the Recovery services vault.

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