12 March, 2015

How to allow Jenkins installation access to your MS SQL Server

if you want to run integration tests against the database and your tests shall be automated with jenkins, then you will need to add the jenkins service (normally you will install jenkins as a windows service) as an sql database user.

so how to find out how the user is called?

open your jenkins installation and go to its system properties.

you can either reach it via the URL


or you navigate to it through by clicking "manage jenkins" > "system information"

there, scroll down. you will find 2 entries:

USERDOMAIN and USERNAME (if your server is part of a domain of course). Example for this would be: CompanyDomain\ServerName$

now, add a new SQL User in sqlexpress by opening sql server managment studio, navigating to security/logins and say "new login..." by right click. use "windows authentication" and enter as the login name <ValueOfUserDomain>\<ValueOfUserName>.
So in our example you would add COMPANYDOMAIN\SERVERNAME$ into here.

Now you of course might also need to give this user appropriate permissions to do stuff, but i leave all that to you!

Happy coding