Build Task Authentication

I'm am a bit of a newbie to TC but I tried searching the forums and documentation for a possible solution to my issue with no luck.  I am reaching out to this community for possible advice.

BACKGROUND
I am attempting to create a build task that runs my NUnit tests as the logged in user with Windows Authentication or a means of specifying the user.  The tests are data validation on a sql db.  The connection string currently is set to Windows Authentication:

Data Source=<SERVER_NAME>;Initial Catalog=<DATABASE_NAME>;Integrated Security=True


The same test work fine when run from nunit-console.exe


CURRENT BEHAVIOR
All NUnit test run and fail.

The error listed for each test is "Test(s) failed. System.Data.SqlClient.SqlException : Login failed for user '<COMPANY_DOMAIN>\SEA-PROG-07$'."


The test appear to have been run under the build agents context(?)


QUESTION
Is there a way to runs my NUnit tests as the logged in user with Windows Authentication or a means of specifying the user?


Thanks for any suggestions.

3 comments
Comment actions Permalink

Hi, and welcome to TeamCity!

To perform builds TeamCity uses agents. Windows Installer registers and starts the first agent as a Windows service. By default this service is running under LocalSystem account, so your NUnit is executed within security context of SEA-PROG-07$ computer account.

You can change the account in the service properties.

Michael

0
Comment actions Permalink

If you change the connection to NOT use integrated security. So the connection string should be along the lines of

Data Source=<SERVER_NAME>;Initial Catalog=<DATABASE_NAME>;User Id=<USERNAME>;Password=<PASSWORD>;

this should then work

0
Comment actions Permalink

Thanks for both responses.  Both ways resolved
the issues equally well.

0

Please sign in to leave a comment.