In VS Code I have defined a task:
"tasks": [ { "label": "getcredentials", "type": "shell", "command": ".\\TestScripts\\GetCredentials.ps1" } ] GetCredentials.ps1 creates a credential and assigns it to $Global:credential.
In launch.json I want to use $Global:credential as an arg to the actual script I am debugging:
"configurations": [ { "type": "PowerShell", "request": "launch", "name": "Exchange Parameter Set, No Inactive", "preLaunchTask": "getcredentials", "script": "${file}", "args": [ "-Credential $Global:credential"], "cwd": "${file}" } ] However, the script doesn't get the value of $Global:credential (it instead prompts for credentials). I thought that this should be possible since this https://code.visualstudio.com/docs/editor/tasks-appendix says that the parent process environment is used if no environment is specified.
Any idea what I'm missing, or is this impossible?