Azure SQL DB "snapshots"
# help-with-other
s
When we hosted a site on it's own server it was simple to have a scheduled job and just backup the db and keep a rolling 7 day and once a month backup. Reason being in case of db corruption we could always at least rollback to the last know safe db. Is there an Azure way to take a copy (ideally a bacpac) whilst the site is live and store this in a container? How do others handle this scenario?
j
Azure SQL has point in time restore already, I think it's on by default. https://learn.microsoft.com/en-us/azure/azure-sql/managed-instance/point-in-time-restore?view=azuresql&tabs=azure-portal You can configure long-term retention policies too: https://learn.microsoft.com/en-us/azure/azure-sql/database/long-term-backup-retention-configure?view=azuresql&tabs=portal This has covered most of my use cases. You can also use the "backup" feature of an app service to capture the database as a bacpac alongside a zip file of the app's files - for this to work the connection string must be set in the web app. Otherwise, a powershell script to trigger an export to blob storage (the same as using the export button in the portal) works pretty well - you can automate it, as well as austomatically download the file afterwards. It's always best to get Azure to do the export rather than try and downlaod it locally as it's a lot faster : https://learn.microsoft.com/en-us/azure/azure-sql/database/database-export?view=azuresql#powershell Bear in mind exports use your database's DTUs, all the data in the db will get read, verified, and compressed so if you've got a big database with low compute then it will take a long time to export (and may use all available performance, taking down the site) - it can be helpful to scale up before an export, then scale down after. https://cdn.discordapp.com/attachments/1206932668080463952/1206952253840166932/image.png?ex=65dde0e1&is=65cb6be1&hm=77d1f3bc3e0c98a05e1969cc3ff72bc17f5a0722f81268ce46e05a8e87f7b96a&
s
That is some gold advice - thank you for your time!