|
| 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: byvinyal |
| 5 | +ms.author: byvinyal |
| 6 | +ms.date: 9/23/2019 |
| 7 | +ms.topic: article |
| 8 | +--- |
| 9 | + |
| 10 | +# Restore deleted App Service app Using PowerShell |
| 11 | + |
| 12 | +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). |
| 13 | + |
| 14 | +## List Deleted Web Apps |
| 15 | + |
| 16 | +To get the collection of deleted apps you can use `Get-AzDeletedWebApp`. |
| 17 | + |
| 18 | +For details on a specific deleted app you can use: |
| 19 | + |
| 20 | +```powershell |
| 21 | +Get-AzDeletedWebApp -Name <your_delted_app> |
| 22 | +``` |
| 23 | + |
| 24 | +The detailed information includes: |
| 25 | + |
| 26 | +- **DeletedSiteId**: Unique identifier for the app, this is used for scenarios where multiple apps with the same name have been deleted |
| 27 | +- **SubscriptionID**: Subscription containing the deleted resource |
| 28 | +- **Location**: Location of the original app |
| 29 | +- **ResourceGroupName**: Name of the original resource group |
| 30 | +- **Name**: Name of the original app. |
| 31 | +- **Slot**: the name of the slot. |
| 32 | +- **Deletion Time**: When was the app deleted |
| 33 | + |
| 34 | +## Restore deleted app |
| 35 | + |
| 36 | +Once you have identified the deleted app, you can restore it using `Restore-AzDeletedWebApp`. |
| 37 | + |
| 38 | +```powershell |
| 39 | +Restore-AzDeletedWebApp -ResourceGroupName <my_rg> -Name <my_app> -TargetAppServicePlanName <my_asp> |
| 40 | +``` |
| 41 | + |
| 42 | +The inputs for this command are: |
| 43 | + |
| 44 | +- **Resource Group**: Target resource group where the app will be restored |
| 45 | +- **Name**: Name for the app, this should be globally unique. |
| 46 | +- **TargetAppServicePlanName**: App Service plan linked to the app |
| 47 | + |
| 48 | +By default `Restore-AzDeletedWebApp` will restore both your app configuration as well a content. If you want to only resotre content, you use the `-RestoreContentOnly` flag with this commandlet. |
0 commit comments