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

如何从Azure App Service Plan移除不存在的Classic VNET连接?

移除App Service Plan中不存在的VNET连接方案

当Azure Portal里的断开按钮不显示时,只能通过命令行或API强制清理无效的VNET连接,以下是三种可行方案:

方案1:Azure CLI操作

  1. 打开Azure CLI终端,登录账号:
    az login
    
  2. 切换到目标订阅(替换为你的订阅ID或名称):
    az account set --subscription <订阅ID/名称>
    
  3. 执行移除命令,替换资源组和App Service Plan名称:
    az appservice plan vnet integration remove --name <App Service Plan名称> --resource-group <资源组名称>
    
  4. 如果CLI提示找不到目标VNET,添加--force参数强制清理无效连接:
    az appservice plan vnet integration remove --name <App Service Plan名称> --resource-group <资源组名称> --force
    

方案2:Azure PowerShell操作

  1. 打开PowerShell,登录Azure账号:
    Connect-AzAccount
    
  2. 切换到目标订阅:
    Set-AzContext -Subscription <订阅ID/名称>
    
  3. 移除无效VNET集成,替换对应的资源组和计划名称:
    Remove-AzAppServicePlanVnetIntegration -ResourceGroupName <资源组名称> -Name <App Service Plan名称>
    
  4. 若遇到报错,添加-Force参数执行强制移除:
    Remove-AzAppServicePlanVnetIntegration -ResourceGroupName <资源组名称> -Name <App Service Plan名称> -Force
    

方案3:Azure REST API操作

如果上述方法都无效,可直接调用REST API清理:

  1. 获取Azure AD授权令牌:
    az account get-access-token --resource https://management.azure.com/
    
  2. 发送DELETE请求到以下端点(替换所有占位符):
    DELETE https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{serverFarmName}/virtualNetworkConnections/{原经典VNET名称}?api-version=2022-03-01
    
  3. 请求头需包含授权信息:
    Authorization: Bearer <步骤1获取的令牌>
    Content-Type: application/json
    

操作完成后,回到Azure Portal刷新页面,无效的VNET连接条目应该会消失。

内容的提问来源于stack exchange,提问作者Pure.Krome

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.09 20:35:16