The runas .NET Core Global Tool allows to run a dotnet process under a specified user account. This tool is compatible with any dotnet CLI commands but the most obvious scenario is running dotnet tests:
-
to install the runas tool, run the command line
dotnet tool install -g dotnet-runas
-
run tests under a specified user account like
dotnet runas -u:username -p:password test
-
to uninstall the runas tool, run the command line
dotnet tool uninstall -g dotnet-runas
For Windows operation system it is possible to specify elevated permissions and other parameters.
🚧 For Linux and OSX operation systems username and password paramers are available.
When building, testing, and deploying an application with TeamCity, you may need to run a build under a specific user account, different from the one used to run the build agent. The teamcity-runas plugin can be used to run TeamCity build steps under a specified user account on Windows, Mac or Linux.
runAs tool for windows
The runAs tool provides the ability to run a Windows process under a specified Windows user account.