You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched all issues to ensure it has not already been reported.
Summary
When debugging PowerShell scripts it is necessary at times to set environment variables to be used for given debug configuration.
This use-case is especially necessary when debugging scripts that are to be used in conjunction with Azure devops YAML pipelines as all pipeline variables are environment variables. Example: Where we have multiple pipeline steps emitting variables (YAML template expression "each" usage) and we use a PowerShell script to gather the outputs for processing and formatting (YAML template expression "join" used to pass parameters to the PowerShell script). Debugging this use-case is harder than it needs to be right now and suggested work arounds, whilst usable, are cumbersome.
Proposed Design
Support for an "env" key for "PowerShell" debugging as per other configuration types please, e.g.
The text was updated successfully, but these errors were encountered:
Thanks for the submission! Have you considered using a pester test and setting up the env variables in that? You can then debug the pester test either with the codelens or with the Pester Tests extension.
That said, this could be possible but there's a lot of considerations for cleanup, etc., I'll flag it as up for grabs.
JustinGrote
changed the title
"env" key in launch.json configuration type: "PowerShell" is not supported.
Feature Request: Support the "env" key in launch.json for debugging Environment Variable setup
May 29, 2024
Prerequisites
Summary
When debugging PowerShell scripts it is necessary at times to set environment variables to be used for given debug configuration.
This use-case is especially necessary when debugging scripts that are to be used in conjunction with Azure devops YAML pipelines as all pipeline variables are environment variables. Example: Where we have multiple pipeline steps emitting variables (YAML template expression "each" usage) and we use a PowerShell script to gather the outputs for processing and formatting (YAML template expression "join" used to pass parameters to the PowerShell script). Debugging this use-case is harder than it needs to be right now and suggested work arounds, whilst usable, are cumbersome.
Proposed Design
Support for an "env" key for "PowerShell" debugging as per other configuration types please, e.g.

The text was updated successfully, but these errors were encountered: