Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Powershell 2.0 inline script does not support passing arguments #4971

Closed
kzu opened this issue Aug 4, 2017 · 9 comments
Closed

Powershell 2.0 inline script does not support passing arguments #4971

kzu opened this issue Aug 4, 2017 · 9 comments
Assignees

Comments

@kzu
Copy link

kzu commented Aug 4, 2017

The File Path-based script allows passing in arguments:

image

The Inline one does not, however:

image

This significantly reduces its usefulness when used in task groups that can automatically discover configurable inputs from arguments used in a script.

Relevant PR: #4578

@ericsciple
Copy link
Contributor

can you add the macros into the inline script itself?

@kzu
Copy link
Author

kzu commented Aug 7, 2017

Surely can.

Discoverability plummets and integration with task groups that can automatically discover those arguments and make them task group input properties configurable by the user completely vanishes though.

@ericsciple
Copy link
Contributor

ericsciple commented Aug 7, 2017

OK sounds like a bug in task groups then. I'm not sure why it would treat the inline script input differently.

@kzu
Copy link
Author

kzu commented Aug 7, 2017

You do not think the arbitrary inconsistency in uex between inline and file path scripts is a bug regardless?

Not sure what was the reasoning behind providing Arguments for one and not the other, but the only thing that makes sense to me is to either have it in both, or remove it altogether.

@kzu
Copy link
Author

kzu commented Aug 7, 2017

Funny! If I do configure the task Arguments first and then switch to Inline (thus the field Arguments dissappear) the task group UI does see the args, but they are never passed down to the inline script. Quite confusing ;)

@chrispat
Copy link
Contributor

chrispat commented Aug 7, 2017

The reason they are different is because you can simply put the variables in the inline script which should be a lot simpler than dealing with arguments. In the case of the file you have no option to do that.

@kzu
Copy link
Author

kzu commented Aug 7, 2017

I'd say the current experience is still more confusing than having it available in both, even if the variables can be used in the inline script directly, since that feature isn't easily discoverable (that is, it isn't even a working PS script if you try to run it on your machine with those variables in place), whereas using arguments makes for way easier testing too before uploading.

@iyerusad
Copy link

iyerusad commented Sep 7, 2017

@chrisrpatterson

The reason they are different is because you can simply put the variables in the inline script which should be a lot simpler than dealing with arguments

Alas, unless I am mistaken, this breaks ability to use data retrieved from Azure Key Vault task. Actually using inline script appears to break all capability to retrieve ANY secret variables.

  1. Use Azure Key Vault task to pull down a vault.
    image
  2. Attempt to reference secrets pulled in previous task, using a powershell/batch/shell task using inline option - unable to extract the Key vault data pulled down.
    image

No results:

2017-09-07T20:38:42.0319456Z ##[section]Starting: PowerShell Script
2017-09-07T20:38:42.0329255Z ==============================================================================
2017-09-07T20:38:42.0329255Z Task         : PowerShell
2017-09-07T20:38:42.0329255Z Description  : This is an early preview. Run a PowerShell script on Windows, macOS, or Linux.
2017-09-07T20:38:42.0329255Z Version      : 2.121.0
2017-09-07T20:38:42.0329255Z Author       : Microsoft Corporation
2017-09-07T20:38:42.0329255Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613736)
2017-09-07T20:38:42.0329255Z ==============================================================================
2017-09-07T20:38:43.0071563Z Generating script.
2017-09-07T20:38:43.0681597Z ##[command]"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -File "d:\a\_temp\2ea4c913-5aec-405e-b326-008e447c8ee2.ps1"
2017-09-07T20:38:45.2496213Z ##[section]Finishing: PowerShell Script

@ericsciple
Copy link
Contributor

@iyerusad you can use the macro syntax $(mySecret) syntax to pass secrets (same way if using a separate arguments text box).

alternatively, in yaml you can also pass via the env dictionary. env dictionary will come to web designer in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants