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

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

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

Accepted values: AzureFileShare, MSSQL, SAPHANA, SAPHanaDatabase, SQLDataBase, VM
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 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

--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 backup policy. You can use the backup policy list command to get the name of a policy.

--resource-group -g

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

--subscription

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

--vault-name -v

Name of the Recovery services vault.

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

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

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

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

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

Accepted values: All, Disabled, Enabled
Default value: All
--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.

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.

Accepted values: AzureFileShare, MSSQL, SAPHANA, SAPHanaDatabase, SQLDataBase, VM
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 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

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

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.

--name -n

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

--resource-group -g

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

--subscription

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

--vault-name -v

Name of the Recovery services vault.

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

Examples

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

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

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

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

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

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.

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

--subscription

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

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

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

--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 backup policy. You can use the backup policy list command to get the name of a policy.

--resource-group -g

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

--subscription

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

--vault-name -v

Name of the Recovery services vault.

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.