Azure-pipelines-tasks: What's the correct syntax for passing inline PowerShell script arguments?

Created on 13 Dec 2016  路  2Comments  路  Source: microsoft/azure-pipelines-tasks

Hi,

I can't seem to pass named arguments to an inline script and couldn't find any documentation for it. What's the correct syntax?

Most helpful comment

this works for me:
Type: Inline Script
Arguments: -myparam1 'my param value 1' -myparam2 'my param value 2'
Inline Script:

param($myparam1, $myparam2)

write-host "myparam1 is $myparam1"
write-host "myparam2 is $myparam2"

All 2 comments

this works for me:
Type: Inline Script
Arguments: -myparam1 'my param value 1' -myparam2 'my param value 2'
Inline Script:

param($myparam1, $myparam2)

write-host "myparam1 is $myparam1"
write-host "myparam2 is $myparam2"

I was missing the param($myparam1, $myparam2) statement. Might be useful in the task input tooltip. Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

apobekiaris picture apobekiaris  路  58Comments

danielcirket picture danielcirket  路  74Comments

letmaik picture letmaik  路  55Comments

omanuke picture omanuke  路  48Comments

JacobHenner picture JacobHenner  路  108Comments