You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何删除App Service应用的内容(不删除应用资源本身)

如何重置/取消部署Azure App Service应用内容(保留资源)

下面是几种实用的操作方法,按需选择:

1. 用Kudu控制台手动清空内容

  • 登录Azure门户,找到目标App Service资源
  • 左侧菜单点击高级工具,再点“Go”打开Kudu控制台
  • 顶部选择Debug console > CMD(或PowerShell)
  • 进入site\wwwroot目录,执行命令删除所有文件:
    • CMD:del /f /s /q *
    • PowerShell:Remove-Item -Path .\* -Recurse -Force

2. Azure CLI命令一键重置

打开终端执行以下命令,移除部署源关联并清空站点内容:

az webapp deployment source delete --name <你的AppService名称> --resource-group <资源组名称>

若仅需清空wwwroot目录,可使用:

az webapp deploy --name <AppService名称> --resource-group <资源组名称> --src-path /dev/null --target-path /home/site/wwwroot --clean true

3. Azure PowerShell操作

打开PowerShell执行命令,删除部署历史并清空站点内容:

Remove-AzWebAppDeployment -ResourceGroupName <资源组名称> -Name <AppService名称>

4. 部署中心断开连接并清空

  • 进入App Service的部署中心页面
  • 若当前关联了GitHub、Azure Repos等部署源,点击断开连接,勾选“删除现有部署内容”后确认
  • 操作完成后会移除部署源关联,同时清空站点文件

⚠️ 注意:操作前请备份重要内容,避免数据丢失。

内容的提问来源于stack exchange,提问作者me.at.coding

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.30 02:04:54