Hello, hopefully someone can help me:
We would like to remote run a TeamCity build from another website.
What I did was set up a build configuration with some predefined (but empty) build parameters so I can make a http webrequest to TeamCity's REST Api, something like the following:
Empty build parameters in this example (there are more, but i included only 2 for the sake of simplicity)
And the corresponding REST Url passing the parameters to TeamCity
This works, so far so good, now to the problem:
It seems I can only use basic authentication with username and password embedded in cleartext in the url. Sure, I can Setup https but still there is no way to get the users credentials in the application that makes the above http/s request.
This would be important because we want to know who started the build, if we just use a hardcoded service account for the request, the whole auditing feature TeamCity provides are useless (because every build would be run via service account).
Do I really need to authenticate to TeamCity with basic authentication or is it possible to use something like integrated authentication (like IIS).
TeamCity is Running on Windows Server 2k8, standard Tomcat Installation.
Thanks, best regards
Yes, you should be able to use REST with NTLM authentication.
It might depend on whether your client supports the option, though.
e.g. I managed to use curl to use NTLM with a command line like:
curl -v --ntlm --user USERNAME http://teamcity:8111/app/rest/server
I tried to use NTLM for the rest API and it didn't work. But I did manage it to work using NTLM + basic Auth.
You first use NTLM in the /ntlmLogin.html page and then use the cookie that TeamCity provides to you in the API.
See https://github.com/eduaquiles/TeamCityNtlmApiWrapper with a small example on how to do this.