๐Ÿ“š
Aditya Kumar
  • About me
    • Resume
  • Automating Amazon EBS
  • ECS Bluegreen with Lambda SWAP
  • First drive of AWS Chatbot
  • Talking COVID-19 with Amazon Lex
  • Managed Jupyter on AWS SageMaker
  • Extending GitOps to reliability-as-code with GitHub and StackPulse
  • HashiCorp Packer for Machine Images
  • Deleted My Web App and App Service Plan, Whats Next ?
  • Using Terraform for zero downtime updates of an Auto Scaling group in AWS
  • Automating Instagram Posts with AI: A Step-by-Step Guide
  • Merge Commit Message Validator for Pull Requests
  • Automating Jenkins Data Backup with rsync and Slack Notifications
  • Creating a One-Time Setup for Kubernetes Cluster with Worker Nodes Using HAProxy
Powered by GitBook
On this page

Was this helpful?

Deleted My Web App and App Service Plan, Whats Next ?

PreviousHashiCorp Packer for Machine ImagesNextUsing Terraform for zero downtime updates of an Auto Scaling group in AWS

Last updated 3 years ago

Was this helpful?

As a human being we all can do mistakes. There for we can delete production grade Azure Web App accidentally. Sometimes this scenarios can be happen when hacker penetrate the Azure subscription credentials and get control, and intentionally delete production Web App.

So whats happen now. What if we want to recover it quickly. Earlier we need to submit a support ticket to Azure to restore Azure Web App and it take hours if you donโ€™t have premier support. But introduction of Azure App Service Web App Undelete we can restore the app without any support plan.

YES you can imagine how cool it was right. Lets see how we can do it.

Deleted Web apps are stored in Subscription base so if you have multiple subscription first we need to select right subscription for that we can use following Azure PowerShell commands

#Login to Azure PowerShell
Login-AzureRmAccount#Select Azure Subscription
Select-AzureRmSubscription -Subscription "<SubName>"

Make sure you have the latest version of Azure Powershell Module AzureRM.Websites 5.1.0

#Get Azure RM Powershell Module Version
Get-Module -Name AzureRM.Websites#Get Latest PowerShell Module
Install-Module -Name AzureRM.Websites -RequiredVersion 5.1.0

Before this demo I created a Web app and deleted from my Resource Group name DeleteWebapp. So lets see the deleted Web App (Times are in UTC)

#Get Deleted Web App
Get-AzureRmDeletedWebApp -ResourceGroupName DeleteWebapp

Next Iโ€™ll create PS variable to store the deleted app details

#Store As a Variable
$deletedApp= Get-AzureRmDeletedWebApp -ResourceGroupName DeleteWebapp

We will create a new Resource group to restore this app, then create an App Service Plan to restore the deleted app. NOTE โ€” Make Sure the App service Plan is Basic or higher tire restoring feature is not supported for free tier

#Create new Resource Group for Web App restore 
New-AzureRmResourceGroup -Name WebAppRestore -Location "Central US"#Create an App Service Plan 
New-AzureRmAppServicePlan -Location "Central US" -Tier Standard -Name WebAppRestoreAppPlan -ResourceGroupName WebAppRestore

Lets restore deleted web app to the newly created App Service plan. For that previous step we sore the details of the deleted web app as a variable, we can use that variable to restore the web app.

#restore the web App
$deletedApp | Restore-AzureRmDeletedWebApp -TargetResourceGroupName WebAppRestore -TargetAppServicePlanName WebAppRestoreAppPlan

If you have done this correctly you can see that the web app state is running at shell and portal we can see the app running

NOTE โ€” We can restore deleted web apps up to 30 days from deletion date, and its compliant with GDPR. As per the GDPR it canโ€™t keep customer data more than 30 days

Rock Garden,Darjeeling,India