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 "http://infratc.thenetworkinc.net/httpAuth/app/rest/builds" -UseDefaultCredentials

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

Thanks,
Rob

0
3 comments

Hi Robert,

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

0
Avatar
Permanently deleted user

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.

0

Hi Janne,

 

You will usually need to get first through the ntlm login, you can find an example here: https://stackoverflow.com/a/28068241/1244241. Could you check whether that one works?

0

Please sign in to leave a comment.