Restore-AzureRmWebAppSnapshot

Restores a web app snapshot.

Warning

The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.

Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.

Syntax

Restore-AzureRmWebAppSnapshot
       [-RecoverConfiguration]
       [-Force]
       [-AsJob]
       [-ResourceGroupName] <String>
       [-Name] <String>
       [[-Slot] <String>]
       [-DefaultProfile <IAzureContextContainer>]
       [-InputObject] <AzureWebAppSnapshot>
       [-WhatIf]
       [-Confirm]
       [<CommonParameters>]
Restore-AzureRmWebAppSnapshot
       [-RecoverConfiguration]
       [-Force]
       [-AsJob]
       [-WebApp] <PSSite>
       [-DefaultProfile <IAzureContextContainer>]
       [-InputObject] <AzureWebAppSnapshot>
       [-WhatIf]
       [-Confirm]
       [<CommonParameters>]

Description

Restores a web app snapshot to the web app. Restoring a snapshot overwrites all files in a web app with the files contained in the snapshot. To restore settings as well, use the RecoverConfiguration switch parameter. A snapshot from one web app can be restored to any other web app in the same subscription.

Examples

Example 1

PS C:\> $snapshot = (Get-AzureRmWebAppSnapshot -ResourceGroupName "Default-Web-WestUS" -Name "ContosoApp" -Slot "Staging")[0]
PS C:\> Restore-AzureRmWebAppSnapshot -ResourceGroupName "Default-Web-WestUS" -Name "ContosoApp" -Slot "Restore" -InputObject $snapshot -RecoverConfiguration

Gets the latest snapshot of a web app named "ContosoApp" with a slot named "Staging" in the "Default-Web-WestUS" resource group. Restores the snapshot to the web app's "Restore" slot.

Parameters

-AsJob

Run cmdlet in the background

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Force

Allows the original web app to be overwritten without displaying a warning.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-InputObject

The Azure Web App snapshot.

Type:AzureWebAppSnapshot
Position:3
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Name

The name of the web app.

Type:String
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-RecoverConfiguration

Recover the web app's configuration in addition to files.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ResourceGroupName

The name of the resource group.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Slot

The name of the web app slot.

Type:String
Position:2
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-WebApp

The web app object

Type:PSSite
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

SwitchParameter

String

Site

Parameters: WebApp (ByValue)

AzureWebAppSnapshot

Parameters: InputObject (ByValue)

Outputs

Void