# Policies

Policies allow you to group storage instances in many ways. For example, based on the type of storage provider.

To create a new backup policy, open the Backup SLAs tab under the Storage Provider section and click on the **Create** button on the right.

![](https://content.gitbook.com/content/0FWMFN0y1yUTAd3cSRaK/blobs/wvXCwTBcQbcT0yo87AXP/administration-storage_providers-backup_sla-policies_1.png)

Now you should see the policy wizard with 5 main sections.

![](https://content.gitbook.com/content/0FWMFN0y1yUTAd3cSRaK/blobs/6LGUGHC1LpblDwZ57VCb/administration-storage_providers-backup_sla-policies_3.png)

## General

Under this section you can set up:

* Name of policy
* Switch on/off auto-remove non-present virtual environments
* Set the priority for tasks

## Auto-assignment

In this section you can configure automatic policy assignment based on certain criteria:

* Mode
  * Disabled
  * Assign only
  * Assign and remove
* Include or exclude rules based on regular expressions matching storage instance names, i.e.:
  * regular expression examples:
    * `.*` match any character any number of times
    * `st-[0-9][0-9][0-9]` - match names that start with `st-` and 3 digits
    * `(prod|uat|dev)-[0-9][0-9][0-9][a-z]?` - match names that start with the `prod` or `uat` or `dev` prefix, then `-`, then 3 digits and an optional lower-case letter (matching is case-sensitive)
  * exclude rules always take precedence over include rules
  * objects may not be reassigned to a different policy if they already have a matching policy assigned
  * objects may be reassigned to a different policy only if the mode is `Assign and remove`, the current policy assignment rules don't match, and the other policy's rules do match
  * rules are joined with the OR operator, so
    * if **any** rule (tag or matched regular expression) excludes the storage instance - it will be excluded
    * if **no** rule (tag or matched regular expression) excludes the storage instance, and **any** rule (tag or matched regular expression) includes the VM - it will be included
* You can also select clusters to match only VMs that belong to them

## Storage

Here you can easily select storage instances manually.

## Rule

This section is used to select the backup destination.

![](https://content.gitbook.com/content/0FWMFN0y1yUTAd3cSRaK/blobs/XMFe9qxUpuQF9kfaRqm0/administration-virtual_environments-backup-slas-policies_3.png)

{% hint style="info" %}
**Note:** You can select Primary and Secondary Backup Destintanion in one Rule
{% endhint %}

You can also set here **Retention** settings for your backups. You can use a number of days and versions for full and incremental backups.

If you have already created a schedule, you can also select it or Create New Schedule.

## Retention

Storware Backup & Recovery handles retention for all backup destinations except NetBackup. There are 4 properties that define how long backup should be kept in the backup destination:

* `Retention (Full) - no. of versions to keep` - number of full backups
* `Retention (Inc.) - no. of versions to keep` - number of incremental backups
* `Retention (Full) - no. of days to keep` - number of days to keep a full backup
* `Retention (Inc.) - no. of days to keep` - number of days to keep an incremental backup

{% hint style="info" %}
**Note:** If you are using [Synthetic File System](https://docs.storware.eu/backup-and-recovery-7.4/deployment/backup-destinations/filesystem/synthetic-file-system) backup destination, you have only two options for retention:

* `Retention - no. of versions to keep` - number of full backups
* `Retention - no. of days to keep` - number of days to keep a full backup
  {% endhint %}

Whichever condition is met first (either number of versions has been reached or the backup is older than the given limit), it is removed from the backup destination.

## Other

This is an optional section with two switches:

* Fail the rest of the backup tasks if more than xx% of EXPORT tasks have already failed
* Fail the rest of the backup tasks if more than xx% of STORE tasks have already failed

Here are two examples of when using switches is very useful: It is very likely that if 30% of the backup tasks fail, the remaining tasks will also fail because the environment has failed. Or, if you are backing up a set of storage instances, and if even one is not secured, there is no point in backing up the rest.

At the end, save the settings.

{% hint style="info" %}
**Note:** You can also perform the same action thanks to the CLI interface: [CLI Reference](https://docs.storware.eu/backup-and-recovery-7.4/administration/cli-reference)
{% endhint %}
