, ,

Filtering backups in Azure App service

Avatar de Vinicius

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

azure app service backups status failed blog vinicius deschamps

A new blade will open, and check the Log Details

azure app service backups restore backup log details blog vinicius deschamps

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

azure app service advanced tools go blog vinicius deschamps

Once in KUDU, choose Site extensions

azure app service kudu site extensions blog vinicius deschamps

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

azure app service kudu site extensions gallery search azure web app disk blog vinicius deschamps

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

azure app service kudu site extensions azure web apps disk usage site extension add blog vinicius deschamps

Then acknowledge the installation by clicking Install

azure app service kudu site extensions acknowledgement blog vinicius deschamps

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

azure app service kudu site extensions restart app service blog vinicius deschamps

Wait for a couple minutes and hit the Play button

azure app service kudu site extensions azure web apps disk usage site extension execute blog vinicius deschamps

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

azure app service kudu site extensions azure websites disk usage blog vinicius deschamps

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

azure app service advanced tools go blog vinicius deschamps

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

azure app service kudu add new file blog vinicius deschamps

Name the new file as _backup.filter

azure app service kudu backup filter blog vinicius deschamps

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

azure app service kudu edit backup filter blog vinicius deschamps

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)

azure app service kudu edit backup filter add exclusion blog vinicius deschamps

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

azure app service backups backup after backup filter blog vinicius deschamps

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!

azure app service backups backup succeeded after backup filter blog vinicius deschamps

And that’s it!

I hope you liked it, and I’ll see you on my next post.

Photo by Brett Jordan on Unsplash

Avatar de Vinicius

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *