I have tests, written in C#, that are run in an automated TFS build. One of the tests requires admin privileges (to access a certificate) so it fails every time in an automated build/test. If I run visual studio as administrator the test passes. I have tried disabling UAC on the build server (which is running Windows 7 and TFS 2012) but it still doesn't automatically elevate. Is there any way to specify that the tests need to run as admin (similar to an app.manifest)?
Asked
Active
Viewed 1,448 times
1 Answers
0
The TFS build service runs under a service account and builds and tests are run under the context of this account. In order to run unit tests as admin then this account would need to be a member of the administrator group on the machine.
Now doing this is potentially risky as the build service will blindly follow any instructions given to it by msbuild.
You could possibly move the certificate in to a user certificate store rather that the computer store but in not sure what impact this would have on the code you are trying to test.

James Reed
- 13,873
- 51
- 60
-
Correct, however, do these service accounts normally have access to the system certificate store or the ability to use the private key from the certificate? It seems weird to me that there is no way to allow this service to be elevated. – Kyle Preiksa May 03 '13 at 17:11