Back up App Service on Azure Stack Hub
This document provides instructions on how to back up App Service on Azure Stack Hub.
App Service on Azure Stack Hub isn't backed up as part of Azure Stack Hub infrastructure backup. As an Azure Stack Hub Operator, you must take steps to ensure App Service can be successfully recovered if necessary.
Azure App Service on Azure Stack Hub has four main components to consider when planning for disaster recovery:
- The resource provider infrastructure; server roles, worker tiers, and so on.
- The App Service secrets.
- The App Service SQL Server hosting and metering databases.
- The App Service user workload content stored in the App Service file share.
Back up App Service secrets
When recovering App Service from backup, you need to provide the App Service keys used by the initial deployment. This information should be saved as soon as App Service is successfully deployed and stored in a safe location. The resource provider infrastructure configuration is recreated from backup during recovery using App Service recovery PowerShell cmdlets.
Use the administration portal to back up app service secrets by following these steps:
Sign in to the Azure Stack Hub administrator portal as the service admin.
Browse to App Service -> Secrets.
Select Download Secrets.
When secrets are ready for downloading, click Save and store the App Service secrets (SystemSecrets.JSON) file in a safe location.
Repeat these steps every time the App Service secrets are rotated.
Back up the App Service databases
To restore App Service, you need the Appservice_hosting and Appservice_metering database backups. We recommend using SQL Server maintenance plans or Azure Backup Server to ensure these databases are backed up and saved securely on a regular basis. However, any method of ensuring regular SQL backups are created can be used.
To manually back up these databases while logged into the SQL Server, use the following PowerShell commands:
$s = "<SQL Server computer name>" $u = "<SQL Server login>" $p = read-host "Provide the SQL admin password" sqlcmd -S $s -U $u -P $p -Q "BACKUP DATABASE appservice_hosting TO DISK = '<path>\hosting.bak'" sqlcmd -S $s -U $u -P $p -Q "BACKUP DATABASE appservice_metering TO DISK = '<path>\metering.bak'"
If you need to back up SQL AlwaysOn databases, follow these instructions.
After all databases have been successfully backed up, copy the .bak files to a safe location along with the App Service secrets info.
Back up the App Service file share
App Service stores tenant app info in the file share. This file share must be backed up on a regular basis along with the App Service databases so that as little data as possible is lost if a restore is required.
To back up the App Service file share content, use Azure Backup Server or another method to regularly copy the file share content to the location you've saved all previous recovery info.
For example, you can use these steps to use Robocopy from a Windows PowerShell (not PowerShell ISE) console session:
$source = "<file share location>" $destination = "<remote backup storage share location>" net use $destination /user:<account to use to connect to the remote share in the format of domain\username> * robocopy $source $destination net use $destination /delete
Submit and view feedback for