Use default credentials when connecting to teamcity API

TC 9.1.3 running on Windows 2012 R2.

I have LDAP and Microsoft Windows Domain enabled, as well as Basic HTTP and NTLM http. I want to allow automated processes to connect to TC to get information about builds, trigger builds, etc using the API. Since I'm in a pure windows environment, I was hoping I could just leverage the existing Windows identity management features, and not have to store credentials anywhere. I tried the following PowerShell snippet:

Invoke-WebRequest -uri "" -UseDefaultCredentials

But I got 401'd for my trouble. Is what I want to do possible? If so, please let me know.


Comment actions Permalink

Hi Robert,

Please see the related thread in forum and try the suggested solution.

Comment actions Permalink

I also got 401 when trying to use -UseDefaultCredentials with PowerShell  Invoke-WebRequest. Links provided in above answer don't work anymore so I cannot see suggested solution from there.

Comment actions Permalink

Hi Janne,


You will usually need to get first through the ntlm login, you can find an example here: Could you check whether that one works?


Please sign in to leave a comment.