【Azure App Service】误删除App Service资源,怎么办?

问题描述

操作不当,误删除了App Service的资源,怎么办?

 

问题解答

根据Azure 官方文档,可以使用 Powershell 命令恢复到原始 App Service 应用名称。

操作步骤

第一步:列出已删除的应用

Get-AzDeletedWebApp  
Get-AzDeletedWebApp  |Format-Table -Property DeletionTime,Name,Location,ResourceGroupName,SubscriptionId, Id,DeletedSiteId
Get-AzDeletedWebApp -Name <your web app name> |Format-Table -Property DeletionTime,Name,Location,ResourceGroupName,SubscriptionId, Id,DeletedSiteId 

执行截图:

  

第二步:还原已删除的应用

Restore-AzDeletedWebApp -ResourceGroupName <original_rg> -Name <original_app> -TargetResourceGroupName <target_rg> -TargetName <target_app> -TargetAppServicePlanName <target_asp>

执行截图:

 

完整的PowerShell脚本为:
 Connect-AzAccount -Environment AzureChinaCloud
  
 Select-AzSubscription -Subscription 'your subscription id'

 Restore-AzDeletedWebApp -TargetResourceGroupName <my_rg> -Name <my_app> -TargetAppServicePlanName <my_asp>

 Restore-AzDeletedWebApp -ResourceGroupName <original_rg> -Name <original_app> -TargetResourceGroupName <target_rg> -TargetName <target_app> -TargetAppServicePlanName <target_asp>

 

参考资料

Install Azure PowerShell on Windows : https://learn.microsoft.com/en-us/powershell/azure/install-azps-windows?view=azps-11.1.0&tabs=powershell&pivots=windows-psgallery 

使用 PowerShell 还原已删除的应用服务应用:https://learn.microsoft.com/zh-cn/azure/app-service/app-service-undelete 

 

posted @   路边两盏灯  阅读(40)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
历史上的今天:
2022-12-12 【Azure 存储服务】MP4视频放在Azure的Blob里面,用生成URL在浏览器中打开之后,视频可以正常播放却无法拖拽视频的进度
2020-12-12 【Azure Developer】通过Azure提供的Azue Java JDK 查询虚拟机的CPU使用率和内存使用率
点击右上角即可分享
微信分享提示