Why is the "System" running on the TeamCity command line?

I have an auth problem with TeamCity when running a command line build. This is due to the existing question about running the svn validation command , but I want to ask here explicitly:

Why this happens when the TeamCity Build Agent service is configured to run under a specific Active Directory account and not a local system account when this command is executed:

echo "%username%"

I get this assembly output:

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

It really ruins my attempts to execute commands under the ID of my AD service account, why is this happening? Other build leaders (i.e., MSBuild) run under the service account identifier, why doesn't this happen on the command line?

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

Update 2: . The output of the set command shows the username as System, but the user profile points to the service account name:

[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]
+3
source share
1 answer

Did you try to restart the service after changing credentials? I mean both the teamcity server and the build agent

0
source

Source: https://habr.com/ru/post/1780388/


All Articles