Issue with running dotnet test on build server


I have setup a build server at the company I work for.
This build server interactively works with Visual Studio Team Services.

Building works great and so does publish. The issue I am running in to is the ability to run “dotnet test” as a different user.

This is needed because currently the user the agent runs under is a service account. It has access to IIS and has the ability to move files where they need to be. But it does not have access to the database.

Since we have a few integration tests that we utilize, it errors out when connecting to the database because it is trying to connect as the service user.

So far I have not found a way to run “dotnet test” as a different user, specifically one that has access to query the database.

I tried utilizing the VSTS Task “Run Powershell on Remote Machines” since it lets me supply a username and password. But it seems to have issues trying to remotely connect to itself (which is probably understandable).

I am at a loss. I have no idea how to get this to work. Except giving the service user the ability to run those queries on the database.

Any help is greatly appreciated!

.NET Foundation Website | Blog | Projects | Code of Conduct