10

I installed TeamCity on Windows Server 2012. It has been working fine setting up a few builds. I then attempted to install some plugins by putting .zip files in the ~/.BuildServer/plugins folder. I restarted the server by cd'ing to c:\TeamCity\bin and running "runAll stop" followed by "runAll start".

Then when I go to the teamcity page for several minutes I get a "Enter the maintenance authentication token" page. It says on the page to find the maintenance token in the teamcity-server.log file (see screenshot below). I look in c:\TeamCity\logs\teamcity-server.log and it has several "super user token" and "agent authorizationtoken". I tried using these token but get an invalid maintenance token error.

TeamCity Enter the Maintenance Authentication Token

So my question is where do I find the maintenance token?

Edit: This has resolved itself for me since upgrading to the latest TeamCity version. None of the suggested answers worked at the time I had this problem so that's why I am not marking anything as the accepted answer.

fredw
  • 1,409
  • 12
  • 23
  • On Windows, TeamCity is usually installed as a Windows Service. I wonder if by running `runAll start` manually it is running differently (i.e. in a different directory) to how it usually does under the Windows Service and can't access the previous config. Have you tried starting it via the Windows Service? – Jonathon Rossi Jul 18 '15 at 08:42
  • Good suggestion- I am now starting it as a service instead of using `runAll`, however same result. The log files all get update with info when I restart the server and agent, but no maintenance token. – fredw Jul 21 '15 at 05:42
  • In my logfile ("C:\TeamCity\logs\teamcity-server.log") it only says "Current stage: Confirming TeamCity first start (administrator login is required to proceed)" and no token is available. – habakuk Jun 08 '16 at 13:31

9 Answers9

10

Please check out file teamcity-winservice.log in logs subfolder of your Teamcity. Auth token should be here.

  • Unfortunately I don't see any maintenance token in there, only the superuser token. I also checked other log files such as teamcity-auth.log. – fredw Jul 21 '15 at 05:40
  • @RezaAhmadi I would love to, except I don't see the token in that file. I am wondering if it is something with my specific setup preventing it from appearing. – fredw Jun 21 '16 at 21:34
  • 1
    After upgrading TeamCity (and seeing the page where I needed to enter the auth token), this was the last line in the teamcity-winservice.log file: Administrator can login from web UI using authentication token: NNNN – HenricF Mar 08 '17 at 14:54
  • Worked for me with 2017.1.4. To get at the end of the log a new line with expected token, just validate a wrong one on form. A new line like "WARN - jetbrains.buildServer.STARTUP - Failed maintenance authentication from IP address /0:0:0:0:0:0:0:1 with token: "x". Current authentication token: "4115402144571543048" will be added. – AFract Sep 25 '17 at 15:50
6

open cmd goto TeamCity instalation folder

C:\TeamCity\bin

type

runAll.bat stop

wait until services stoped then type

runAll.bat start

u will see current authentication token in console,.

Peter Badida
  • 11,310
  • 10
  • 44
  • 90
SSGeek
  • 71
  • 1
  • 3
4

It should be in the file teamcity-server.log which is in the logs subfolder of your TeamCity installation - look for the text "Administrator login is required from web UI using authentication token" and a long number afterwards which is your token.

Also see the docs for TeamCity Maintenance Mode.

BrokenGlass
  • 158,293
  • 28
  • 286
  • 335
3

Had the same issue it is the Superuser token you want (it will be the last line in the log unless you have tried to login - which will show in here as failures)

Along the lines of

Administrator can login from web UI using authentication token: 1234567890

/Edited so line in log file is more obviously a quote and added an example token thanks @Kleopatra,

Scrambledheads
  • 130
  • 1
  • 3
  • 13
2

Took me a while to find it, but it's in the file as indicated, but it's the very last line.

Ian Vink
  • 66,960
  • 104
  • 341
  • 555
0

if you are hitting on this issue https://youtrack.jetbrains.com/issue/TW-43100 in TeamCity (v10.0.4) for IE, you may need to enable javascript and also add the url to IE trusted site list.

JosephKumarMichael
  • 971
  • 1
  • 7
  • 9
0

If you cannot find in the log, just type a random value. The web ui will inform you that entered an invalid token.

Afterwards go to the log (TeamCity/logs/teamcity-server.log) and check the last line:

[2018-03-27 17:55:20,258] WARN - jetbrains.buildServer.STARTUP - Failed maintenance authentication from IP address /86.234.23.62 with token: "6056431478480274143". Current authentication token: "6418830881320521552"

giorgos.nl
  • 2,704
  • 27
  • 36
0
  • I tried restarting the Teamcity service.
  • I tried the runAll stop start thing.

Didn't work for me.

I rebooted then found the superuser token in TeamCity/logs/teamcity-server.log

Josh
  • 101
  • 7
0

You will find multiple super user authentication token in the file specified (TeamCity\logs\teamcity-server). You can always use the last one in the file. (if there is not one in the last line, try logon with random number, you can get an authorization failed message with the token number included and it will be added to the file)