1

I have been following Standard Environments for Automated Deployment and Testing and I have run into some errors.

I have two servers, one Windows Server 2008 R2 and another Windows Server 2012. On both I've installed Web Deploy 3 and the service Web Deployment Agent Service is running on both machines. I have the service account in my domain and I added the account on both machines to Administrators group. I also used this account for the Build and Test controller and agent.

The 2008 server is the build server and I want to deploy a website with the build server to the 2012 server. I have one build definition that makes the package with the zip and deploy.cmd etc. with the standard TFS 2012 Update 2 process template (added /p:DeployOnBuild=True as MS build argument).

I have another build definition based on the LabDefaultTemplate TFS 2012 update 2 template. In the lab process templates I added the following command on the deploy tab:

"$(BuildLocation)\_PublishedWebsites\UI.Web.Mvc4_Package\UI.Web.Mvc4.deploy.cmd" /y /m:SERVERNAME_OF_THE_2012_SERVER

When I run the second build definition, I get the "Access Denied" error. I don't know where it is coming from. I don't see any special things here happening. I also set the log to diagnostic but that doesn't work.

When I make a connection with Remote Desktop to the 2008 build server and manually run the same deploy.cmd, everything is working. The site is deployed on the 2012 server and everything is running.

Can someone help me?

Thanks

Added log from the build:

Deploy Build on Environment

00:22
Deploying Build

00:22
Run Deployment scripts
Initial Property Values
Values = Web Server | $(BuildLocation)\_PublishedWebsites\UI.Web.Mvc4_Package\start.bat

00:22
Run Deployment Task
Initial Property Values
BuildLocation = \\AP-GDA06-TFSB\DropFolder\Dev MVC4\Dev MVC4_20130510.11
DeploymentScriptDetails = Web Server | $(BuildLocation)\_PublishedWebsites\UI.Web.Mvc4_Package\start.bat
LabEnvironmentUri = vstfs:///LabManagement/LabEnvironment/3
MaxWaitTime = 00:30:00
ThrowOnError = True
UseRoleForDeployment = True
Deployment Task Logs for Machine: 2012_SERVER
 Access is denied
 Exception Message: Team Foundation Server could not complete the deployment task for machine '2012_SERVER', script '\\2008_SERVER\DropFolder\Dev MVC4\Dev MVC4_20130510.11\_PublishedWebsites\UI.Web.Mvc4_Package\start.bat' and arguments ''. (type LabDeploymentProcessException)
Exception Stack Trace: 
Server stack trace: 
   at Microsoft.TeamFoundation.Lab.Workflow.Activities.RunDeploymentTask.ExecuteDeploymentTask.RunCommand(AsyncState state)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
   at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
   at System.Action`1.EndInvoke(IAsyncResult result)
   at Microsoft.TeamFoundation.Lab.Workflow.Activities.RunDeploymentTask.ExecuteDeploymentTask.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
   at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
Final Property Values
BuildLocation = \\2008_SERVER\DropFolder\Dev MVC4\Dev MVC4_20130510.11
DeploymentScriptDetails = Web Server | $(BuildLocation)\_PublishedWebsites\UI.Web.Mvc4_Package\start.bat
LabEnvironmentUri = vstfs:///LabManagement/LabEnvironment/3
MaxWaitTime = 00:30:00
ThrowOnError = True
UseRoleForDeployment = True
Final Property Values
Values = Web Server | $(BuildLocation)\_PublishedWebsites\UI.Web.Mvc4_Package\start.bat

The BAT file that is started contains the following command:

START UI.Web.Mvc4.deploy.cmd /y /m:2012_SERVER
9
  • Can you provide more of the error message? You should be able to open the build and "View Log" to see exactly what happened and where... You may need to change the "Logging verbosity" in your build process to "Diagnostic" and run it again. Commented May 10, 2013 at 18:57
  • Oh, are you running on a local server or on tfs.visualstudio.com ? Commented May 10, 2013 at 19:00
  • I'm running TFS 2012 and the build servers locally. So no cloud envolved here. I added the log part that is throwing the error. Commented May 12, 2013 at 8:35
  • The log is in diagnostic mode Commented May 12, 2013 at 8:36
  • I'm a little bit further. I a the group "Everyone" permission on our DropFolder of the build server, the script is executed fine. Now I need to know which account I need to give permissions and not everyone... Commented May 13, 2013 at 15:15

3 Answers 3

1

If you start build definition which is using DefaultLabTemplate you should see following in your build log:

...

If deployment needed
 Do deployment
  Reserve Environment For Deployment
  Deploy Build on Environment
    Deploying Build
      Run Deployment scripts
        Run Deployment Task
          Deployment Task Logs for Machine: <your machine> 
            Accessing the following location using the lab service account: <your service account>, <your drop location>.

...

Do you see that the Lab Service account is using?

Sign up to request clarification or add additional context in comments.

6 Comments

I'm asking this because if you define Lab Service account it does not apply to the existing lab environments, you have to update them, see msdn.microsoft.com/en-us/library/ee712736.aspx
I see the line "" and the machine is right. that is the server where it should be deployed to. I don't see the line "Accessing the following location using the lab service account". So i navigated to your url but TFSLabConfig command tool doesn't recognize any "UpdateServiceAccountOnDeployedEnvironments" command. I should look in the team foundation server 11 folder and not on the 2010 folder right? We are using TFS 2012 Update 2.
Elena, do you have any where I can find the UpdateServiceAccountOnDeployedEnvironments in TFS 2012? thanks
The folder C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE on the client machine should be the right one. Looks like the MSDN article is not correct….
The other possibility to update an existing environment is described at the end of this article: msdn.microsoft.com/en-us/library/dd692846.aspx I’m working with SCVMM environments so I only had to reset my environments to their initial snapshots after configuring Test Controller for using Lab Service Account. But since you are using standard environment and they do not support snapshots I suppose the easiest way will be to recreate your environment(s).
|
0

Check this answer: https://stackoverflow.com/a/16566204/648297

This was the solution in my case.

This could be useful for you, too: What is Lab Service Account?

4 Comments

I filled in the Lab Service account. I unintalled the TFS 2012 agent from the deployment server. I also removed the server from the lab management. I restarted the test controller. Added the server to deploy to in lab management with that lab service account again. The agent is again installed but without luck. When I add the user "domain\ComputerNameToDeploy$" on the dropfolder with only read permissions everything is working so it has to do with the user
When I go to the server that I have configured in lab management and start the test agent configuration tool I see the lab service account configured. When I go to services, I see Visual Studio Lab Agent Service and Visual Studio Network Agent Service running under "Local System". Shouldn't this also be the lab service account????
I've just created a further answer since the comments have limited length and do not allow proper formatting...
Visual Studio Lab Agent Service and Visual Studio Network Agent Service should NOT running under Lab Service, "Local System" is fine.
0

Using Visual Studio 2012 Update 4, and Team Foundation Server, on a one-way trust or isolated/workgroup network configuration, we have found an additional step is required. When running automated unit tests via the Build-Deploy-Test workflow (but not Web Deploy), we have found that setting the lab service account is only part of the solution. In order to avoid Access is denied errors in the build, we also had to set the user for the Visual Studio Lab Agent Service.

This is what the services in the Services applet look like after setting the lab service account (in this example, ".\LabAdmin"):

Visual Studio Lab Agent Service         | Configures, monitors... | Running | Automatic | Local System  
Visual Studio Lab Network Agent Service | Sets network propert... | Running | Automatic | Local System  
Visual Studio Test Agent                | Provides distributed... | Running | Automatic | .\LabAdmin  

In order to fix the Access is denied error, we also had to run the Visual Studio Lab Agent Service under the lab service account:

Visual Studio Lab Agent Service         | Configures, monitors... | Running | Automatic | .\LabAdmin  
Visual Studio Lab Network Agent Service | Sets network propert... | Running | Automatic | Local System  
Visual Studio Test Agent                | Provides distributed... | Running | Automatic | .\LabAdmin  

After making this change, and restarting the services, the Access is denied error went away. This was repeated on two different target computers, at least with our configuration it appears to be a necessary step.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.