Deployment using release pipeline in DevOps

I am trying to deploy to a site hosted in litiums shared environment using a release pipeline in DevOps. When using the provided publish profile with Visual Studio it works fine but not from DevOps. I’ve tried deploying using msdeploy but it always fails with the following error:

2020-09-30T09:40:49.2550673Z ##[error]System.Management.Automation.RemoteException: Error Code: ERROR_USER_UNAUTHORIZED
2020-09-30T09:40:49.2560934Z ##[error]System.Management.Automation.RemoteException: More Information: Connected to the remote computer ("***Server Name***") using the Web Management Service, but could not authorize. Make sure that you are using the correct user name and password, that the site you are connecting to exists, and that 
2020-09-30T09:40:49.2565331Z ##[error]System.Management.Automation.RemoteException: the credentials represent a user who has permissions to access the site.  Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_UNAUTHORIZED.
2020-09-30T09:40:49.2574350Z 
2020-09-30T09:40:49.2575833Z ##[error]System.Management.Automation.RemoteException: Error: The remote server returned an error: (401) Unauthorized.
2020-09-30T09:40:49.2579772Z 
2020-09-30T09:40:49.2580861Z ##[error]System.Management.Automation.RemoteException: Error count: 1. 

The msdeploy command that are executed looks like this:

"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package='Release-20200930.2.zip' -dest:auto,computerName='https://***Server Name***:8172/msdeploy.axd?site=***IIS Site Name***',userName='LITIUMDRIFT\***User Name***',password='***Password***',authType='basic',includeAcls='False' -allowUntrusted

Is what I’m trying to do even possible or am I doing it wrong?
Any suggestions are welcome

Thanks

Litium version: 7

We have struggled with this quite a bit also.

I don’t know why there is a difference when deploy from visual studio and deploying from azure devops but there are. The deployment from azure devops in our case was trying to deploy to wrong website even though website is specified in the call to the service it is the parameter files inside the deployment artifact that determines site it tries to deploy to.

We solved this by adding a powershell script that generates a parameter file with the correct site information to the release process for deployment to shared environment.

    New-Item $(System.DefaultWorkingDirectory)/setParameters.xml -ItemType File
Add-Content $(System.DefaultWorkingDirectory)/setParameters.xml '<?xml version="1.0" encoding="utf-8"?>'
Add-Content $(System.DefaultWorkingDirectory)/setParameters.xml '<parameters>'
Add-Content $(System.DefaultWorkingDirectory)/setParameters.xml '  <setParameter name="IIS Web Application Name" value="Customer-Test" />'
Add-Content $(System.DefaultWorkingDirectory)/setParameters.xml '  <setParameter name="FoundationConnectionString" value="Data Source=LIT-TESTSQL02;Initial Catalog=Customer-Test-Rev1;Integrated Security=true;" />'
Add-Content $(System.DefaultWorkingDirectory)/setParameters.xml '</parameters>'

Then we also include reference to the correct parameter in the msdeploy service request and we use a batchscript instead of any existing devops for msdeploy specific plugin.
-verb:sync -source:package='$(SourcePackage)' -setParamFile:"$(ParametersFile)" -dest=auto,computerName='$(DestinationServer)',username='$(UserName)',password='$(Password)',authType=basic,includeAcls='False' -skip:objectName=createApp -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -allowUntrusted

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.