Using a YAML pipeline paramter in a PowerShell task is straight forward for types such as string. For example, if there is a YAML pipeline parameter named env of type string, we can read it in PowerShell task with $envName = '${{ parameters.env }}; without any issue. However, if the parameter is type of object we cannot read, the paramter the same way we do with string parameters. If we try to read object parameter named apps, $apps = '${{ parameters.apps}}; , there will be an YAML validation error staring the pipeline such as below.
/azure-pipelines.yml (Line: 57, Col: 23): Unable to convert from Array to String. Value: Array
Even if we try to use below it will be same issue.
[String[]]$apps = '${{ parameters.apps}};
[PSObject[]]$apps = '${{ parameters.apps}};
Let's explore the issueand solution in detail.