如何在使用 Azure cloudshell 克隆 Web 应用程序时修复 'conflicts with an already existing hostname'

how to fix 'conflicts with an already existing hostname' while cloning web app using Azure cloudshell

场景:您想将应用程序克隆到另一个区域,同时配置包含两个 apps 的 Azure 资源管理器流量管理器配置文件。

下面是我试过的命令

$srcapp = Get-AzWebApp -ResourceGroupName SourceAzureResourceGroup -Name 
source-webapp

$destapp = New-AzWebApp -ResourceGroupName DestinationAzureResourceGroup -Name dest-webapp -Location "South Central US" -AppServicePlan DestinationAppServicePlan -SourceWebApp $srcapp -TrafficManagerProfileName newTrafficManagerProfile

以上命令失败并显示“"Creating app with backup from 'subscriptiondetailshere' failed: Detail: Hostname \'abc.xyz.companydomain.com\' conflicts with an already existing hostname. ExtendedCode: 04005"

仅供参考:apps 托管在标准应用程序服务计划中。我确实读过文档说只能克隆高级 apps 但我能够通过 Azure 门户 UI.

在标准计划中克隆这个特定的应用程序

我希望能够使用 ps 自动执行此操作。任何指针表示赞赏

https://docs.microsoft.com/en-us/azure/app-service/app-service-web-app-cloning

更新:

复制的网络应用程序:

交通管理员:


首先,azure web app clone 确实支持standard app service plan。这是 doc:

的屏幕截图

其次,你使用的代码是正确的,我在我这边做了测试,它工作正常(网络应用程序是从美国中部复制到美国西部,复制后,一切正常):

对于冲突错误,如果存在具有该主机名的现有 Web 应用程序,您应该检查目标资源组(您提到可以从 Azure 门户复制,也许您在删除时没有删除它使用代码复制它)。