简体   繁体   中英

How to get Azure Devops Web Applications to deploy

I am setting up Azure Devops to deploy a .Net Core Web Application to Azure. In Visual Studio, I have created a publish profile and publishing with this profile works correctly. I use the user name and password from the portal.

Now I am trying to get this to work in an Azure Devops pipeline. There are steps to get Nuget packages, get key vault secrets, and build. I have verified that the zip file package is getting created correctly.

I am using an "Azure App Service Deploy" step for deployment. It points to the pubxml profile and the zip package and the password is the same one that I use for publishing from Visual Studio. When it runs, I get the following 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.

Looking at the log, it is issuing the following command:

 "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -source:package='D:\a\1\a\CallService.zip' -dest:auto,computerName="https://xxxxx.scm.azurewebsites.net:443/msdeploy.axd?site=xxxxx",userName="xxxx",password="xxxxx",authtype="basic",includeAcls="False" -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:"D:\a\1\a\CallService.SetParameters.xml"  -enableRule:DoNotDeleteRule -retryAttempts:6 -retryInterval:10000

The user name and password have been redacted here but they match what is in the portal for deployment credentials and what I am using fom Visual Studio.

I would expect this to work since the Visual Studio deploy is working with the same profile and creds. I would like to know if anyone knows how to make the deployment work from Azure DevOps.

I also use Azure Devops deploy web application.
In my way , I create Azure Active Directory application Firstly.
And I give Access control of web application to Azure Active Directory application.
Then I add Azure Active Directory application to Azure devops as Azure Resource Manager service connection.
On "Azure App Service Deploy" step, I use this Azure Resource Manager service connection to deploy.
I hope it will help you.

To me this error ERROR_USER_NOT_AUTHORIZED_FOR_CREATEAPP appeared because I did not have the {project name}_IisWebApplication paremter in my passed parameter-Xml file. Its value should be the same as seen in your site= URL parameter (here xxxxx ).

So, if your URL contains this site parameter and the site parameter value:

-dest:auto,computerName="https://xxxxx.scm.azurewebsites.net:443/msdeploy.axd?site=xxxxx"

Your parameter file D:\\a\\1\\a\\CallService.SetParameters.xml should look like this:

<parameters>
  <setParameter name="ProjectX_IisWebApplication" value="xxxxx"/>
</parameters>

(replace "ProjectX" with your project name, I was looking up the correct IisWebApplication-parameter name in the file called generated.parameters.xml generated by the build process of Visual Studio.

If your file D:\\a\\1\\a\\CallService.SetParameters.xml or other build parameters also contain a parameter called IIS Web Application Name , its value should be set to xxxx as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM