|
| 1 | +--- |
| 2 | +title: Restore deleted App Service apps - Azure App Service |
| 3 | +description: Learn how to restore a deleted App Service app using PowerShell. |
| 4 | +author: btardif |
| 5 | +ms.author: byvinyal |
| 6 | +ms.date: 9/23/2019 |
| 7 | +ms.topic: article |
| 8 | +ms.service: app-service |
| 9 | +--- |
| 10 | + |
| 11 | +# Restore deleted App Service app Using PowerShell |
| 12 | + |
| 13 | +If you happened to accidentally delete your app in Azure App Service, you can restore it using the commands from the [Az PowerShell module](https://docs.microsoft.com/powershell/azure/?view=azps-2.6.0&viewFallbackFrom=azps-2.2.0). |
| 14 | + |
| 15 | +## List Deleted Web Apps |
| 16 | + |
| 17 | +To get the collection of deleted apps, you can use `Get-AzDeletedWebApp`. |
| 18 | + |
| 19 | +For details on a specific deleted app you can use: |
| 20 | + |
| 21 | +```powershell |
| 22 | +Get-AzDeletedWebApp -Name <your_deleted_app> |
| 23 | +``` |
| 24 | + |
| 25 | +The detailed information includes: |
| 26 | + |
| 27 | +- **DeletedSiteId**: Unique identifier for the app, used for scenarios where multiple apps with the same name have been deleted |
| 28 | +- **SubscriptionID**: Subscription containing the deleted resource |
| 29 | +- **Location**: Location of the original app |
| 30 | +- **ResourceGroupName**: Name of the original resource group |
| 31 | +- **Name**: Name of the original app. |
| 32 | +- **Slot**: the name of the slot. |
| 33 | +- **Deletion Time**: When was the app deleted |
| 34 | + |
| 35 | +## Restore deleted app |
| 36 | + |
| 37 | +Once the app you want to restore has been identified, you can restore it using `Restore-AzDeletedWebApp`. |
| 38 | + |
| 39 | +```powershell |
| 40 | +Restore-AzDeletedWebApp -ResourceGroupName <my_rg> -Name <my_app> -TargetAppServicePlanName <my_asp> |
| 41 | +``` |
| 42 | + |
| 43 | +The inputs for command are: |
| 44 | + |
| 45 | +- **Resource Group**: Target resource group where the app will be restored |
| 46 | +- **Name**: Name for the app, should be globally unique. |
| 47 | +- **TargetAppServicePlanName**: App Service plan linked to the app |
| 48 | + |
| 49 | +By default `Restore-AzDeletedWebApp` will restore both your app configuration as well a content. If you want to only restore content, you use the `-RestoreContentOnly` flag with this commandlet. |
0 commit comments