Filtering Files and Folders in Azure Backup

backup-hero-img
This post will show you how to filter out specific files, file types, and sub-folders from a back selection when using the Azure Backup MARS agent to protect files and folders on a Windows PC or server.
 

 

The Problem

The MARS agent is typically being used in a few scenarios:

  • Small-to-midsized enterprises
  • Remote branch offices
  • Mobile workers

An administrator or a user might configure a backup selection, but there’s nothing that you can do to prevent users in these liberal environments from dumping their movie or music collection into the backup selection.
The last few versions of Windows Server have included file type filtering to prevent storage of unwanted files, but few are aware that this role feature even exists. It also won’t prevent a situation where the files are allowed but we do not want to back them up.
Another scenario that I encountered was an application that ingested terabytes of temporary files into the data folders; in this case, the temp files were large and scattered throughout the folder structure and existed for hours or days, making it impossible to deselect them.
In both cases, the increased storage impacts costs: the instance charge ($10 for 500GB, RRP) and the amount of blob storage that will be required in Azure to accommodate the backup. We need a means to filter out those files, file types, and folders that are unwanted by the business.

Filtering the Backup Selection

You can control which files, file types, and folders are not backed up:

  • When creating a new backup schedule
  • By modifying an existing backup schedule

This is done in a dialog box that you can access by clicking the Exclusion Settings button in the Select Items To Backup screen.

Azure Backup’s Select Items To Backup screen [Image Credit: Aidan Finn]
Azure Backup’s Select Items To Backup screen [Image Credit: Aidan Finn]
The Exclusion Settings screen appears; this is where you will create exclusion rules for this machine’s backup policy.
Un-configured Exclusion Settings in Azure Backup [Image Credit: Aidan Finn]
Un-configured Exclusion Settings in Azure Backup [Image Credit: Aidan Finn]
In my lab I have several rules that I want to set up to prevent selected data from being backed up. I am backing up a folder called Files. Within that folder, there is a subfolder and files that I do not want to include in my backup policy.

Click Add Exclusion to create a new exclusion rule. A Select Items dialog box appears; using this dialog box I can browse through the folder/file structure of the machine to select items to exclude. I am going to start by excluding a sub-folder called Temp that contains files that I do not need.
Excluding a folder from Azure Backup [Image Credit: Aidan Finn]
Excluding a folder from Azure Backup [Image Credit: Aidan Finn]
I can only select one item at a time, so I click OK. I am returned to Exclusion Settings where a new rule is created. Note that all files and folders and all sub-folders within the selected folder are excluded by default. I can modify this rule by typing/selecting different entries if I require.
Preventing a folder from being backed up by Azure Backup [Image Credit: Aidan Finn]
Preventing a folder from being backed up by Azure Backup [Image Credit: Aidan Finn]
I need more exclusion rules, so I continue working here. I want to prevent a large file from being backed up. Once again I click Add Exclusion, and I browse to and select the file to exclude. Note how a specific file path is indicated in File Type in the new exclusion rule.
Excluding a specific file from Azure Backup [Image Credit: Aidan Finn]
Excluding a specific file from Azure Backup [Image Credit: Aidan Finn]
I know that my users are storing a lot of files that are not work related, such as music and video. The owner of the server hasn’t bothered using the built-in file filtering features of Windows Server, but I must keep the Azure bills down. These files are scattered throughout the file system, so I cannot just block a folder – this will also block business-related files from being backed up. I need to prevent certain file types from being backed up.
I can create another rule for each file type by selecting the folder that contains those files. Then I will edit the File Type entry to create a wildcard for those file types, such as *.MP3 or *.MKV.
Preventing Azure Backup from protecting certain file types [Image Credit: Aidan Finn]
Preventing Azure Backup from protecting certain file types [Image Credit: Aidan Finn]

This process will reduce the amount of data that is being backed up. This might also be a way that you can use to gradually grow what is being backed up to Azure if you don’t enough bandwidth for an initial backup and the disk transfer method is not an option for you; you can get critical data protected via an initial online backup and then remove rules over time to add more data to the backup set.