I've created a Publish Profile for a Web Application. I can successfully Publish manually (right click project, Publish, then select the Profile - Publish Method is "Web Deploy").
In the profile, I've entered a UserName (which has Admin rights on the IIS server) and Password (and checked save password) - it has created an encrypted password in the pubxml.user file.
I've created a Build Definition, and am using MSBuild arguments to do a "Deploy on Build" using my Publish Profile. If I include UserName and Password, the Build and Publish succeeds. I want to NOT hard-code the UserName and Password in the MSBuild arguments (I'm assuming I can somehow use/access what is set in the Publish Profile).
I've tried setting the Web Management Service to use/allow for NTLM (by adding the the Registry key for WindowsAuthenticationEnabled), but still no dice. Here are my MSBuild arguments:
This works (publish succeeds):
/p:DeployOnBuild=true;PublishProfile=DEVProfile;VisualStudioVersion=12.0;AllowUntrustedCertificate=true;AuthType=NTLM;UserName=<actual domain\userid>;Password=<actual password>
These do NOT work (publish fails with error below) - (I've read some posts saying include an empty UserName, I think to prevent MSDeploy from defaulting to Basic Authentication)
/p:DeployOnBuild=true;PublishProfile=DEVProfile;VisualStudioVersion=12.0;AllowUntrustedCertificate=true;AuthType=NTLM
/p:DeployOnBuild=true;PublishProfile=DEVProfile;VisualStudioVersion=12.0;AllowUntrustedCertificate=true;AuthType=NTLM;UserName=
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets (4255): Web deployment task failed. (Connected to the remote computer ("<actual server name>") using the Web Management Service, but could not authorize.
Here are the relevant DEVProfile.pubxml settings:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<AuthType>NTLM</AuthType>
<LastUsedBuildConfiguration>DEV</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<MSDeployServiceURL>actual iis host server</MSDeployServiceURL>
<DeployIisAppPath>actual iis site name</DeployIisAppPath>
<RemoteSitePhysicalPath />
<SkipExtraFilesOnServer>False</SkipExtraFilesOnServer>
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
<EnableMSDeployBackup>True</EnableMSDeployBackup>
<UserName>actual domain\userid</UserName>
<_SavePWD>True</_SavePWD>
I also tried storing the password in the pubxml file <Password>actual password</Password>, but this doesn't work either. (This would have at least removed the password from the MSBuild arguments). I know some values are being pulled from the pubxml (i.e. MSDeployServiceURL, DeployIisAppPath), but it seems UserName (and Password) are being ignored.