Overwriting your own parameters in Release Management can cause Powershell remoting problems

I have been doing some work on vNext Release Management; I managed to waste a good hour today with a stupid error.

In vNext process templates you provide a username and password to be used as the Powershell remoting credentials (in the red box below)


My Powershell script also took a parameter username, so this was provided as a custom configuration too (the green box). This was the issue. Not unsurprisingly having two parameters with the same name is a problem. You might get away with it if they are the same value (I did on one stage, which caused more confusion), but if they differ (as mine did in my production stage) the last one set wins, which meant my remote Powershell returned the error

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.AggregateException: One or more errors occurred. —> Microsoft.TeamFoundation.Release.Common.Helpers.OperationFailedException: Permission denied while trying to connect to the target machine Gadila.blackmarble.co.uk on the port:5985 via power shell remoting.

Easy to fix once you realise the problem, a logon failure is logged on the target machine in the event log. Just make sure you have unique parameters