I want to be able to run MsBuild jobs using a user different from the user running the agent process.
- CloudBees CI (CloudBees Core) on modern cloud platforms - Managed controller
- CloudBees CI (CloudBees Core) on traditional platforms - Client controller
- CloudBees Jenkins Enterprise - Managed controller
- CloudBees Jenkins Platform - Client controller
- CloudBees Jenkins Distribution
- Jenkins LTS
- Jenkins MSBuild Plugin
In order to be able to cover this use case, you will only need to add the user name and the password as parameters as mentioned in the [plugin page]((https://plugins.jenkins.io/msbuild).
The syntax should be the one supported by MsBuild to add these kind of parameters
/P:Username=myuser;Password=mypassword you can get additional details on how to pass username and password safely in the following Microsoft Forum post. But please, be aware that you should not use passwords in the command line please check also Injecting Secrets into Jenkins Build Jobs for additional techniques to avoid using passwords in a non secure way.
Please, be aware that any special character included in your username or password should be escaped, otherwise you will get an error during the job execution.
One easy way to rule out if your problem is related to this is to use a user/password combination that does not include any special character.