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](https://viniciusdeschamps.com.br/wp-content/uploads/2020/11/azure-app-service-backups-status-failed-blog-vinicius-deschamps-1024x628.png)
A new blade will open, and check the Log Details
![azure app service backups restore backup log details blog vinicius deschamps](https://viniciusdeschamps.com.br/wp-content/uploads/2020/11/azure-app-service-backups-restore-backup-log-details-blog-vinicius-deschamps-1024x313.png)
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](https://viniciusdeschamps.com.br/wp-content/uploads/2020/11/azure-app-service-advanced-tools-go-blog-vinicius-deschamps-1024x215.png)
Once in KUDU, choose Site extensions
![azure app service kudu site extensions blog vinicius deschamps](https://viniciusdeschamps.com.br/wp-content/uploads/2020/11/azure-app-service-kudu-site-extensions-blog-vinicius-deschamps.png)
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](https://viniciusdeschamps.com.br/wp-content/uploads/2020/11/azure-app-service-kudu-site-extensions-gallery-search-azure-web-app-disk-blog-vinicius-deschamps.png)
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](https://viniciusdeschamps.com.br/wp-content/uploads/2020/11/azure-app-service-kudu-site-extensions-azure-web-apps-disk-usage-site-extension-add-blog-vinicius-deschamps.png)
Then acknowledge the installation by clicking Install
![azure app service kudu site extensions acknowledgement blog vinicius deschamps](https://viniciusdeschamps.com.br/wp-content/uploads/2020/11/azure-app-service-kudu-site-extensions-acknowledgement-blog-vinicius-deschamps.png)
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](https://viniciusdeschamps.com.br/wp-content/uploads/2020/11/azure-app-service-kudu-site-extensions-restart-app-service-blog-vinicius-deschamps-1024x320.png)
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](https://viniciusdeschamps.com.br/wp-content/uploads/2020/11/azure-app-service-kudu-site-extensions-azure-web-apps-disk-usage-site-extension-execute-blog-vinicius-deschamps.png)
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](https://viniciusdeschamps.com.br/wp-content/uploads/2020/11/azure-app-service-kudu-site-extensions-azure-websites-disk-usage-blog-vinicius-deschamps-1024x482.png)
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](https://viniciusdeschamps.com.br/wp-content/uploads/2020/11/azure-app-service-advanced-tools-go-blog-vinicius-deschamps-1024x215.png)
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](https://viniciusdeschamps.com.br/wp-content/uploads/2020/11/azure-app-service-kudu-add-new-file-blog-vinicius-deschamps-1024x342.png)
Name the new file as _backup.filter
![azure app service kudu backup filter blog vinicius deschamps](https://viniciusdeschamps.com.br/wp-content/uploads/2020/11/azure-app-service-kudu-backup-filter-blog-vinicius-deschamps-1024x367.png)
Once the file is created, click at the pencil to edit the file
![azure app service kudu edit backup filter blog vinicius deschamps](https://viniciusdeschamps.com.br/wp-content/uploads/2020/11/azure-app-service-kudu-edit-backup-filter-blog-vinicius-deschamps-1024x366.png)
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](https://viniciusdeschamps.com.br/wp-content/uploads/2020/11/azure-app-service-kudu-edit-backup-filter-add-exclusion-blog-vinicius-deschamps.png)
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](https://viniciusdeschamps.com.br/wp-content/uploads/2020/11/azure-app-service-backups-backup-after-backup-filter-blog-vinicius-deschamps-1024x634.png)
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](https://viniciusdeschamps.com.br/wp-content/uploads/2020/11/azure-app-service-backups-backup-succeeded-after-backup-filter-blog-vinicius-deschamps-1024x467.png)
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