Compartilhar via


Web Apps - Restore

Description for Restores a specific backup to another app (or deployment slot, if specified).

POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/backups/{backupId}/restore?api-version=2024-04-01

URI Parameters

Name In Required Type Description
backupId
path True

string

ID of the backup.

name
path True

string

Name of the app.

resourceGroupName
path True

string

Name of the resource group to which the resource belongs.

Regex pattern: ^[-\w\._\(\)]+[^\.]$

subscriptionId
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.overwrite True

boolean

true if the restore operation can overwrite target app; otherwise, false. true is needed if trying to restore over an existing app.

properties.storageAccountUrl True

string

SAS URL to the container.

kind

string

Kind of resource.

properties.adjustConnectionStrings

boolean

true if SiteConfig.ConnectionStrings should be set in new app; otherwise, false.

properties.appServicePlan

string

Specify app service plan that will own restored site.

properties.blobName

string

Name of a blob which contains the backup.

properties.databases

DatabaseBackupSetting[]

Collection of databases which should be restored. This list has to match the list of databases included in the backup.

properties.hostingEnvironment

string

App Service Environment name, if needed (only when restoring an app to an App Service Environment).

properties.ignoreConflictingHostNames

boolean

Changes a logic when restoring an app with custom domains. true to remove custom domains automatically. If false, custom domains are added to the app's object when it is being restored, but that might fail due to conflicts during the operation.

properties.ignoreDatabases

boolean

Ignore the databases and only restore the site content

properties.operationType

BackupRestoreOperationType

Operation type.

properties.siteName

string

Name of an app.

Responses

Name Type Description
200 OK

Restore operation started.

202 Accepted

Restore operation started.

Other Status Codes

DefaultErrorResponse

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

Restore web app from backup

Sample request

POST https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Web/sites/sitef6141/backups/123244/restore?api-version=2024-04-01

{
  "properties": {
    "storageAccountUrl": "DefaultEndpointsProtocol=https;AccountName=storagesample;AccountKey=<account-key>",
    "overwrite": true,
    "siteName": "sitef6141",
    "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>]"
      }
    ]
  }
}

Sample response

azure-asyncoperation: https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/providers/Microsoft.Web/sites/sitef6141/operationResults/62e4d893-d233-4005-988e-a428d9f77076?api-version=2024-04-01

Definitions

Name Description
BackupRestoreOperationType

Operation type.

DatabaseBackupSetting

Database backup settings.

DatabaseType

Database type (e.g. SqlAzure / MySql).

DefaultErrorResponse

App Service error response.

Details
Error

Error model.

RestoreRequest

Description of a restore request.

BackupRestoreOperationType

Operation type.

Name Type Description
Clone

string

CloudFS

string

Default

string

Relocation

string

Snapshot

string

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

DatabaseType

Database type (e.g. SqlAzure / MySql).

name

string

DatabaseType

Database type (e.g. SqlAzure / MySql).

Name Type Description
LocalMySql

string

MySql

string

PostgreSql

string

SqlAzure

string

DefaultErrorResponse

App Service error response.

Name Type Description
error

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.

RestoreRequest

Description of a restore request.

Name Type Default value Description
id

string

Resource Id.

kind

string

Kind of resource.

name

string

Resource Name.

properties.adjustConnectionStrings

boolean

true if SiteConfig.ConnectionStrings should be set in new app; otherwise, false.

properties.appServicePlan

string

Specify app service plan that will own restored site.

properties.blobName

string

Name of a blob which contains the backup.

properties.databases

DatabaseBackupSetting[]

Collection of databases which should be restored. This list has to match the list of databases included in the backup.

properties.hostingEnvironment

string

App Service Environment name, if needed (only when restoring an app to an App Service Environment).

properties.ignoreConflictingHostNames

boolean

False

Changes a logic when restoring an app with custom domains. true to remove custom domains automatically. If false, custom domains are added to the app's object when it is being restored, but that might fail due to conflicts during the operation.

properties.ignoreDatabases

boolean

False

Ignore the databases and only restore the site content

properties.operationType

BackupRestoreOperationType

Default

Operation type.

properties.overwrite

boolean

true if the restore operation can overwrite target app; otherwise, false. true is needed if trying to restore over an existing app.

properties.siteName

string

Name of an app.

properties.storageAccountUrl

string

SAS URL to the container.

type

string

Resource type.