Azure 应用服务部署版本 4 - ERROR_USER_NOT_AUTHORIZED_FOR_CREATEAPP

Version 4 of Azure App Service Deploy - ERROR_USER_NOT_AUTHORIZED_FOR_CREATEAPP

这是 的后续问题。原始问题的答案对我有帮助,但我被困在其他地方。提醒一下,我想使用发布配置文件部署我的应用程序。我在 Azure 中的 Web 应用程序在 wwwroot 中有两个子文件夹,其中之一称为 backend。我想将我的应用程序部署到该文件夹​​。我不确定为什么 msdeploy 想要创建任何东西,因为 Web 应用程序已经存在 - 我只需要在 backend 文件夹中获取工件。

这是日志的相关部分(部分名称更改为 xyz):

2018-06-14T09:19:25.0295238Z Start executing msdeploy.exe

2018-06-14T09:19:25.0323018Z "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -source:package='D:\a\r1\a\artifacts\drop\xyz.zip' -dest:auto,computerName="https://xyz.scm.azurewebsites.net:443/msdeploy.axd?site=xyz/backend",userName="$xyz",password="***",authtype="basic",includeAcls="False" -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:"D:\a\r1\a\artifacts\drop\xyz.SetParameters.xml" -enableRule:DoNotDeleteRule -retryAttempts:6 -retryInterval:10000

2018-06-14T09:19:25.6154385Z Info: Using ID '89f1210b-39ba-4758-b7ee-76a06407a503' for connections to the remote server.

2018-06-14T09:19:28.0800802Z Info: Creating application (Default Web Site)

2018-06-14T09:19:28.2012951Z ##[debug]rc:1

2018-06-14T09:19:28.2013216Z ##[debug]rc:1

2018-06-14T09:19:28.2013360Z ##[debug]success:false

2018-06-14T09:19:28.2013523Z ##[debug]success:false

2018-06-14T09:19:28.2073234Z ##[error]Failed to deploy web package to App Service.

2018-06-14T09:19:28.2081930Z ##[debug]Processed: ##vso[task.issue type=error;]Failed to deploy web package to App Service.

2018-06-14T09:19:28.2082198Z ##[debug]{}

2018-06-14T09:19:28.2082470Z ##[debug]System.DefaultWorkingDirectory=D:\a\r1\a

2018-06-14T09:19:28.2083178Z ##[error]Error Code: ERROR_USER_NOT_AUTHORIZED_FOR_CREATEAPP More Information: Could not complete an operation with the specified provider ("createApp") when connecting using the Web Management Service. This can occur if the server administrator has not authorized the user for this operation. createApp http://go.microsoft.com/fwlink/?LinkId=178034 Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_NOT_AUTHORIZED_FOR_CREATEAPP.

Error count: 1.

原因是 Azure 期望站点名称将在 scm.azurewebsites.net:443/msdeploy.axd?site=%SiteNameHere%" 中出现两次,并且与参数的值相同,默认情况下文件 SetParameters.xml 中的值用于第二次。

因此,您需要在 xxx.SetParameters.xml 编程(例如 PowerShell 或其他任务)中修改 IIS Web 应用程序名称参数的值,之后它应该可以正常工作。

A​​zure 暂存 Web 部署失败 ERROR_USER_NOT_AUTHORIZED_FOR_CREATEAPP but not for production

我设法解决了这个问题。根据,我需要在SetParameters.xml中设置正确的参数。我通过将以下内容添加到我的 Visual Studio 构建任务来做到这一点:

/p:DeployIisAppPath="xyz"

其中 xyz 是发布配置文件中 DeployIisAppPath 元素的值。