In today’s post I am going to show you how to filtering backups in Azure App Service and keep your application protected.
Regardless the App Service Plan tier, the backup cannot exceed 10GB, and this is the total even if you are backing up databases along with your application.
Backup exceeding 10GB
If your application is exceeding the limit, you should see a failure under your App Service backup Status
The website + database size exceed the 10 GB limit for backups. Your content size is 10 GB.
Go to your App Service, select Backups and choose the Failed backup

A new blade will open, and check the Log Details

There’s a way to exclude things from the backup routine but before we check it, let’s see which files & folders are the cause of this failed backup
Files & Folders
There’s a Site Extension you can install on your App Service, however, it requires to restart after its installation or you could follow the steps listed here to check it through command line
Azure WebSites Disk Usage extension
Navigate to your App Service Advanced Tools, and click Go

Once in KUDU, choose Site extensions

Then choose Gallery (1), type disk (2) and hit Search (3)

Click at the plus sign for Azure Web Apps Disk Usage Site Extension

Then acknowledge the installation by clicking Install

Once the site extension is ready, you will be prompted to restart your site, click Restart Site

Wait for a couple minutes and hit the Play button

A new tab will open and show the folder structure of your App Service, navigate through to find out which is the file or folder that is consuming the most. In my case, it was the logs folder

Filtering backups in Azure App service
Now that you have identified the file or folder it is causing your backup to fail, let’s create a filter to exclude them from the backup
Navigate to your App Service Advanced Tools, and click Go

Navigate to wwwroot of your App Service, then click at the Plus sign (1) and select New file

Name the new file as _backup.filter

Once the file is created, click at the pencil to edit the file

Add the files and folders you need by following the standard \site\wwwroot\[folder]\[file], in my case I added the logs folder (\site\wwwroot\logs) (1), and hit Save (2)

And finally, execute the backup manually by going to your App Service, selecting Backups (1) and pressing Backup (2)

Wait for a while, and check the backup status, and if we have identified the folder/file that was causing the backup becoming too big, the backup should complete successfully!

And that’s it!
I hope you liked it, and I’ll see you on my next post.
Photo by Brett Jordan on Unsplash
Deixe um comentário