Web Apps - Backup
Description for Creates a backup of an app.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backup?api-version=2025-03-01
URI Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
|
name
|
path | True |
string |
Name of the app. |
|
resource
|
path | True |
string minLength: 1maxLength: 90 pattern: ^[-\w\._\(\)]+[^\.]$ |
Name of the resource group to which the resource belongs. |
|
subscription
|
path | True |
string |
Your Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). |
|
api-version
|
query | True |
string |
API Version |
Request Body
| Name | Required | Type | Description |
|---|---|---|---|
| properties.storageAccountUrl | True |
string |
SAS URL to the container. |
| kind |
string |
Kind of resource. |
|
| properties.backupName |
string |
Name of the backup. |
|
| properties.backupSchedule |
Schedule for the backup if it is executed periodically. |
||
| properties.databases |
Databases included in the backup. |
||
| properties.enabled |
boolean |
True if the backup schedule is enabled (must be included in that case), false if the backup schedule should be disabled. |
Responses
| Name | Type | Description |
|---|---|---|
| 200 OK |
OK |
|
| Other Status Codes |
App Service error response. |
Security
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
| Name | Description |
|---|---|
| user_impersonation | impersonate your user account |
Examples
Backup web app
Sample request
POST https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Web/sites/sitef6141/backup?api-version=2025-03-01
{
"properties": {
"storageAccountUrl": "DefaultEndpointsProtocol=https;AccountName=storagesample;AccountKey=<account-key>",
"backupName": "abcdwe",
"enabled": true,
"databases": [
{
"databaseType": "SqlAzure",
"name": "backenddb",
"connectionStringName": "backend",
"connectionString": "DSN=data-source-name[;SERVER=value] [;PWD=value] [;UID=value] [;<Attribute>=<value>]"
},
{
"databaseType": "SqlAzure",
"name": "statsdb",
"connectionStringName": "stats",
"connectionString": "DSN=data-source-name[;SERVER=value] [;PWD=value] [;UID=value] [;<Attribute>=<value>]"
}
],
"backupSchedule": {
"frequencyInterval": 7,
"frequencyUnit": "Day",
"keepAtLeastOneBackup": true,
"retentionPeriodInDays": 30,
"startTime": "2022-09-02T17:33:11.641Z"
}
}
}
Sample response
{
"id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Web/sites/sitef6141",
"name": "sitef6141",
"type": "Microsoft.Web/sites",
"properties": {
"id": 12345,
"storageAccountUrl": "DefaultEndpointsProtocol=https;AccountName=storagesample;AccountKey=<account-key>",
"blobName": "sitef6141_2025-03-01",
"name": "sitef6141_2025-03-01",
"status": "InProgress",
"sizeInBytes": 56091883,
"created": "2022-09-03T17:33:11.641Z",
"log": "Succeeded",
"databases": [
{
"databaseType": "SqlAzure",
"name": "backenddb",
"connectionStringName": "backend",
"connectionString": "DSN=data-source-name[;SERVER=value] [;PWD=value] [;UID=value] [;<Attribute>=<value>]"
},
{
"databaseType": "SqlAzure",
"name": "statsdb",
"connectionStringName": "stats",
"connectionString": "DSN=data-source-name[;SERVER=value] [;PWD=value] [;UID=value] [;<Attribute>=<value>]"
}
],
"scheduled": true,
"lastRestoreTimeStamp": "2022-09-04T17:33:11.641Z",
"finishedTimeStamp": "2022-09-02T17:33:11.641Z",
"websiteSizeInBytes": 56091883
}
}
Definitions
| Name | Description |
|---|---|
|
Backup |
Backup description. |
|
Backup |
Backup status. |
|
Backup |
Description of a backup which will be performed. |
|
Backup |
Description of a backup schedule. Describes how often should be the backup performed and what should be the retention policy. |
|
Database |
Database backup settings. |
|
Database |
Database type (e.g. SqlAzure / MySql). |
|
Default |
App Service error response. |
| Details | |
| Error |
Error model. |
|
Frequency |
The unit of time for how often the backup should be executed (e.g. for weekly backup, this should be set to Day and FrequencyInterval should be set to 7) |
BackupItem
Backup description.
| Name | Type | Description |
|---|---|---|
| id |
string |
Resource Id. |
| kind |
string |
Kind of resource. |
| name |
string |
Resource Name. |
| properties.blobName |
string |
Name of the blob which contains data for this backup. |
| properties.correlationId |
string |
Unique correlation identifier. Please use this along with the timestamp while communicating with Azure support. |
| properties.created |
string (date-time) |
Timestamp of the backup creation. |
| properties.databases |
List of databases included in the backup. |
|
| properties.finishedTimeStamp |
string (date-time) |
Timestamp when this backup finished. |
| properties.id |
integer (int32) |
Id of the backup. |
| properties.lastRestoreTimeStamp |
string (date-time) |
Timestamp of a last restore operation which used this backup. |
| properties.log |
string |
Details regarding this backup. Might contain an error message. |
| properties.name |
string |
Name of this backup. |
| properties.scheduled |
boolean |
True if this backup has been created due to a schedule being triggered. |
| properties.sizeInBytes |
integer (int64) |
Size of the backup in bytes. |
| properties.status |
Backup status. |
|
| properties.storageAccountUrl |
string |
SAS URL for the storage account container which contains this backup. |
| properties.websiteSizeInBytes |
integer (int64) |
Size of the original web app which has been backed up. |
| type |
string |
Resource type. |
BackupItemStatus
Backup status.
| Value | Description |
|---|---|
| InProgress | |
| Failed | |
| Succeeded | |
| TimedOut | |
| Created | |
| Skipped | |
| PartiallySucceeded | |
| DeleteInProgress | |
| DeleteFailed | |
| Deleted |
BackupRequest
Description of a backup which will be performed.
| Name | Type | Description |
|---|---|---|
| id |
string |
Resource Id. |
| kind |
string |
Kind of resource. |
| name |
string |
Resource Name. |
| properties.backupName |
string |
Name of the backup. |
| properties.backupSchedule |
Schedule for the backup if it is executed periodically. |
|
| properties.databases |
Databases included in the backup. |
|
| properties.enabled |
boolean |
True if the backup schedule is enabled (must be included in that case), false if the backup schedule should be disabled. |
| properties.storageAccountUrl |
string |
SAS URL to the container. |
| type |
string |
Resource type. |
BackupSchedule
Description of a backup schedule. Describes how often should be the backup performed and what should be the retention policy.
| Name | Type | Default value | Description |
|---|---|---|---|
| frequencyInterval |
integer (int32) |
7 |
How often the backup should be executed (e.g. for weekly backup, this should be set to 7 and FrequencyUnit should be set to Day) |
| frequencyUnit | Day |
The unit of time for how often the backup should be executed (e.g. for weekly backup, this should be set to Day and FrequencyInterval should be set to 7) |
|
| keepAtLeastOneBackup |
boolean |
True |
True if the retention policy should always keep at least one backup in the storage account, regardless how old it is; false otherwise. |
| lastExecutionTime |
string (date-time) |
Last time when this schedule was triggered. |
|
| retentionPeriodInDays |
integer (int32) |
30 |
After how many days backups should be deleted. |
| startTime |
string (date-time) |
When the schedule should start working. |
DatabaseBackupSetting
Database backup settings.
| Name | Type | Description |
|---|---|---|
| connectionString |
string |
Contains a connection string to a database which is being backed up or restored. If the restore should happen to a new database, the database name inside is the new one. |
| connectionStringName |
string |
Contains a connection string name that is linked to the SiteConfig.ConnectionStrings. This is used during restore with overwrite connection strings options. |
| databaseType |
Database type (e.g. SqlAzure / MySql). |
|
| name |
string |
DatabaseType
Database type (e.g. SqlAzure / MySql).
| Value | Description |
|---|---|
| SqlAzure | |
| MySql | |
| LocalMySql | |
| PostgreSql |
DefaultErrorResponse
App Service error response.
| Name | Type | Description |
|---|---|---|
| error |
Error model. |
Details
| Name | Type | Description |
|---|---|---|
| code |
string |
Standardized string to programmatically identify the error. |
| message |
string |
Detailed error description and debugging information. |
| target |
string |
Detailed error description and debugging information. |
Error
Error model.
| Name | Type | Description |
|---|---|---|
| code |
string |
Standardized string to programmatically identify the error. |
| details |
Details[] |
Detailed errors. |
| innererror |
string |
More information to debug error. |
| message |
string |
Detailed error description and debugging information. |
| target |
string |
Detailed error description and debugging information. |
FrequencyUnit
The unit of time for how often the backup should be executed (e.g. for weekly backup, this should be set to Day and FrequencyInterval should be set to 7)
| Value | Description |
|---|---|
| Day | |
| Hour |