azsk / DevOpsKit-docs

MIT License
497 stars 207 forks source link

]A parameter cannot be found that matches parameter name 'ServiceConnectionNames'. #307

Closed MichelZ closed 4 years ago

MichelZ commented 4 years ago

Trying to use the Security Verification Task in Azure DevOps Pipeline yields this error.

Task Version: 
Task         : Azure DevOps (ADO) Security Verification
Description  : Scan Azure DevOps components for security issues.
Version      : 1.0.14
Author       : azsdktm
Help         : [More Information](http://aka.ms/devopskit/ADOSecurity)

It installs Version 0.9.8 of AzSK.AzureDevOps module.


VERBOSE: Exporting alias 'nwsn'.
Get-AzSKAzureDevOpsSecurityStatus -OrganizationName sample -DoNotOpenOutputFolder -PATToken System.Security.SecureString -ProjectNames "*" -BuildNames "*" -ReleaseNames "*" -ServiceConnectionNames "*" 
##[debug]Caught exception from task script.
##[debug]Error record:
##[debug]ForEach-Object : A parameter cannot be found that matches parameter name 'ServiceConnectionNames'.
##[debug]At line:19 char:13
##[debug]+             ForEach-Object {
##[debug]+             ~~~~~~~~~~~~~~~~
##[debug]    + CategoryInfo          : InvalidArgument: (:) [ForEach-Object], ParameterBindingException
##[debug]    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.ForEachObjectCommand
##[debug] 
##[debug]Script stack trace:
##[debug]at <ScriptBlock>, D:\a\_tasks\ADOSecurityScanner_0f42e73b-1b51-41b9-8bd2-c1a864393316\1.0.14\ADOSecurityScannerSVTRuntime.ps1: line 129
##[debug]at <ScriptBlock>, <No file>: line 1
##[debug]at <ScriptBlock>, <No file>: line 22
##[debug]at <ScriptBlock>, <No file>: line 18
##[debug]at <ScriptBlock>, <No file>: line 1
##[debug]Exception:
##[debug]System.Management.Automation.ParameterBindingException: A parameter cannot be found that matches parameter name 'ServiceConnectionNames'.
##[debug]   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
##[debug]   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
##[debug]   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
##[debug]   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
##[debug]   at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
##[debug]   at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
##[debug]   at System.Management.Automation.ScriptBlock.InvokeWithPipeImpl(ScriptBlockClauseToInvoke clauseToInvoke, Boolean createLocalScope, Dictionary`2 functionsToDefine, List`1 variablesToDefine, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Object[] args)
##[debug]   at System.Management.Automation.ScriptBlock.<>c__DisplayClass57_0.<InvokeWithPipe>b__0()
##[debug]   at System.Management.Automation.Runspaces.RunspaceBase.RunActionIfNoRunningPipelinesWithThreadCheck(Action action)
##[debug]   at System.Management.Automation.ScriptBlock.InvokeWithPipe(Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Pipe outputPipe, InvocationInfo invocationInfo, Boolean propagateAllExceptionsToTop, List`1 variablesToDefine, Dictionary`2 functionsToDefine, Object[] args)
##[debug]   at System.Management.Automation.ScriptBlock.InvokeUsingCmdlet(Cmdlet contextCmdlet, Boolean useLocalScope, ErrorHandlingBehavior errorHandlingBehavior, Object dollarUnder, Object input, Object scriptThis, Object[] args)
##[debug]   at Microsoft.PowerShell.Commands.ForEachObjectCommand.ProcessRecord()
##[debug]   at System.Management.Automation.CommandProcessor.ProcessRecord()
##[error]A parameter cannot be found that matches parameter name 'ServiceConnectionNames'.
##[debug]Processed: ##vso[task.logissue type=error]A parameter cannot be found that matches parameter name 'ServiceConnectionNames'.
##[debug]Processed: ##vso[task.complete result=Failed]
Finishing: ADO Security Scanner

I tried using the vs2017-win2016 and the windows2019 hosted agents

Any idea what could be wrong?

rohank-proarch commented 4 years ago

I am facing the same issue. Getting error: A parameter cannot be found that matches parameter name 'ServiceConnectionNames'. I tried passing in the service connection name as well but no luck. I am using "ADOSecurityScanner" task in Release pipeline. Observation: While running the command in PowerShell, I do not see any parameter named as "ServiceConnectionNames"; as well in the documentation the task do not have "ServiceConnectionNames" parameter but i think the new version has. (Documentation is not updated according to the new release of "ADOSecurityScanner" task)

abhaydaga commented 4 years ago

This issue has been fixed in the latest version (v.0.9.11) of AzSK.AzureDevOps.