问题
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]
回答1:
Have you tried restarting the service after you changed the credentials? I mean both the teamcity server and the build agent
来源:https://stackoverflow.com/questions/4448680/why-does-the-teamcity-command-line-runner-execute-under-system