ZZZSharePoint
ZZZSharePoint

Reputation: 1361

The power shell command do not work in Yaml pipeline in Azure Devops

I am in process of converting my release pipeline to a Yaml pipeline. The task is to call a Power Shell script which is generating some data in a notebook in my SharePoint site. I am able to do it successfully in my release pipeline but in my Yaml Pipeline while calling PowerShell File it is giving me error like

"The '<' operator is reserved for future use." and "The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double quotation marks ("&") to pass it as part of a string."

I see that this is an issue with PowerShell version but then how it is working with my classic release pipeline. How can I fix this for yaml pipeline??

Upvotes: 0

Views: 778

Answers (1)

Yes, this is due is because of the Powershell version. I don't know what are you trying to do with the operator, but an example workaround can be:

.\sample.exe < test.full | tee test.log
Get-Content test.full | .\sample.exe | tee test.log

And regarding the & operator, if you are using it to call another script, you don't need to use the it to call a script from another script. Simply call it by full path name, or .\scriptname.ps1 if it's in the current directory.

If you can't resolve your problem, please show the original powershell script.

Upvotes: 1

Related Questions