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 --name
--policy
--resource-group
--vault-name
[--subscription]

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

Required Parameters

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

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. If provided, no other 'Resource Id' arguments should be specified.

--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. If provided, no other 'Resource Id' arguments should be specified.

--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}]
[--subscription]
[--workload-type {AzureFileShare, 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
--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, 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}]
[--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
--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. If provided, no other 'Resource Id' arguments should be specified.

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

Required Parameters

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

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. If provided, no other 'Resource Id' arguments should be specified.

--name -n

Name of the 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.

az backup policy show

Show details of a particular policy.

az backup policy show --name
[--ids]
[--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. If provided, no other 'Resource Id' arguments should be specified.

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