3

I've got a bit of an auth problem with with TeamCity when running a command line build. It's related to an existing question about executing an svn checkout command but I want to ask it explicitly here:

Why is it that when the TeamCity build agent service is configured to run under a specific Active Directory account and not the local system account, when I execute this command:

echo "%username%"

I get this build output:

[20:52:04]: C:\TeamCity\buildAgent\work\b67560ceb299718c>echo "SYSTEM" 
[20:52:04]: "SYSTEM"

This is really playing havoc with my attempts to execute commands under the identity of my AD service account, why is this happening? Other build runners (i.e. MSBuild) are executing under the identity of the service account, why is this not happening for the command line?

Update 1: Wrapping the command in an MSBuild script with an Exec target does the same thing - current user is still "System".

Update 2: The output of a "set" command is showing the username as "System" but the user profile points to that of the service account:

[13:38:28]: USERDNSDOMAIN=[domain.dns name]
[13:38:28]: USERDOMAIN=[domain]
[13:38:28]: USERNAME=SYSTEM
[13:38:28]: USERPROFILE=C:\Users\[service account]
5
  • may be you should use %user.name%? Dec 15, 2010 at 19:59
  • 1
    The problem is not the ability to get the identity of the current user, that's working just fine. The problem is that the process is not running under the expected identity. And I don't believe %user.name% is valid syntax.
    – Troy Hunt
    Dec 15, 2010 at 20:04
  • confluence.jetbrains.net/display/TCD6/… see Agent Properties table. Dec 15, 2010 at 20:28
  • I don't belive that process with AD identity (build agent) can create process with SYSTEM identity. Dec 15, 2010 at 20:35
  • Ah, I see what you're saying, this is an agent property, I'd been referring to the command line property.
    – Troy Hunt
    Dec 15, 2010 at 20:44

1 Answer 1

0

Have you tried restarting the service after you changed the credentials? I mean both the teamcity server and the build agent

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.