Recovering an Azure SQL Database During a Region Outage
Today we are going to discuss what to do if the Azure region in which you host your Azure SQL Database suddenly becomes unavailable. Many automatically start thinking about active geo-replication and leveraging fail-over groups for your Azure SQL Database. That approach is an excellent one to take if your need or budget fits. However, if you aren’t using geo-replication and fail-over groups, then you can always rely on the backups provided by Azure.
Azure provides point-in-time restores of your Azure SQL Database and, as a bonus, also offers automated backups that leverage read-access, geo-redundant storage (RA-GRS) which is available on all tiers. RA-GRS will leverage the paired Azure region to store the read-only backups. A list of paired regions can be found here. This may end up being the desired strategy for those systems that are not critical and can tolerate a little downtime.
We now have the basic information necessary to restore your Azure SQL Database. We’re going to walk through this example leveraging PowerShell. The first step is to log into Azure.
Connect-AzAccount Set-AzContext -SubscriptionObject $(Get-AzSubscription -SubscriptionName MySub)
Now we can retrieve our last geo-backup that is available for your target database.
$backup = @{ ServerName = "mydemo-dev-eus-ss" DatabaseName = "mydemo-dev-db" ResourceGroup = "mydemo-dev-eus-rg" } $geoBackup = Get-AzSqlDatabaseGeoBackup $backup