4
votes

This is a follow-up question to this question. The answer in the original question helped me, but I am stuck somewhere else. As a reminder, I want to deploy my application using a publish profile. My web app in Azure has two subfolders inside wwwroot and one of them is called backend. I want to deploy my application to that folder. I am not sure why msdeploy wants to create anything, since the web app is already there - I just need to get the artifacts inside the backend folder.

Here is the relevant part of the log (with some names changed to 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.

2
Have you specified the virtual application in the App Service's Application Settings?juunas
Sounds like it thinks the app doesn't exist in IIS and it wants to create one but the deployment user account can't do that.juunas
@juunas I have a virtual application specified: /backend maps to site\wwwroot\backend. Maybe I should change it to a virtual directory instead of an application?Kapol
It's been a long time since I tried virtual directories so I can't say directly what the problem is. Have you looked at this article: blogs.msdn.microsoft.com/tomholl/2014/09/21/…?juunas
I think I have it set up correctly. When I publish manually from VS 2017 using the same publish profile, the publish is successful and my app runs inside the backend folder.Kapol

2 Answers

7
votes

I managed to resolve the issue. According to this answer by @starian chen-MSFT, I needed to set the correct parameter in SetParameters.xml. I did this by adding the following to my Visual Studio Build task:

/p:DeployIisAppPath="xyz"

where xyz is the value of DeployIisAppPath element in the publish profile.

3
votes

The reason is that Azure expecting that site name will be presented twice in scm.azurewebsites.net:443/msdeploy.axd?site=%SiteNameHere%" and the same value as a parameter, by default value from file SetParameters.xml is used for second.

So, you need to modify the value of IIS Web Application Name parameter in xxx.SetParameters.xml programming (e.g. PowerShell or other tasks), after that it should works fine.

Azure staging web deploy fails with ERROR_USER_NOT_AUTHORIZED_FOR_CREATEAPP but not for production