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

az backup policy create

Create a new policy for the given BackupManagementType and workloadType.

az backup policy delete

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

az backup policy get-default-for-vm

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

az backup policy list

List all policies for a Recovery services vault.

az backup policy list-associated-items

List all items protected by a backup policy.

az backup policy set

Update the existing policy with the provided details.

az backup policy show

Show details of a particular policy.

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

Specifiy 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

--subscription

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

--workload-type

Specifiy the type of applications within the Resource which should be discovered and protected by Azure Backup.

accepted values: AzureFileShare, MSSQL, SAPHANA, SAPHanaDatabase, SQLDataBase, VM

az backup policy delete

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

az backup policy delete --name
                        [--ids]
                        [--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

Required Parameters

--name -n

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

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.

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

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 [--ids]
                                    [--resource-group]
                                    [--subscription]
                                    [--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

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.

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

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}]
                      [--query-examples]
                      [--subscription]
                      [--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

Specifiy 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
--query-examples

Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.

--subscription

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

--workload-type

Specifiy the type of applications within the Resource which should be discovered and protected by Azure Backup.

accepted values: AzureFileShare, MSSQL, SAPHANA, SAPHanaDatabase, SQLDataBase, VM

az backup policy list-associated-items

List all items protected by a backup policy.

az backup policy list-associated-items --name
                                       [--backup-management-type {AzureIaasVM, AzureStorage, AzureWorkload}]
                                       [--ids]
                                       [--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

Required Parameters

--name -n

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

Optional Parameters

--backup-management-type

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

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

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

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

--vault-name -v

Name of the Recovery services vault.

az backup policy show

Show details of a particular policy.

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

Examples

Show details of a particular policy

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

Required Parameters

--name -n

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

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.

--query-examples

Recommend JMESPath string for you. You can copy one of the query and paste it after --query parameter within double quotation marks to see the results. You can add one or more positional keywords so that we can give suggestions based on these key words.

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