Product: PowerShell Universal
Version: 5.5.5
I’m looking for some help to dynamically modify Debug and Verbose output on my Endpoints. Our Prod and QA instances are behind PR approvals. It’s time consuming and annoying to our code reviewers to open a PR enable Debug\Verbose output then another to disable it.
I’ve added the CmdletBinding attribute and an empty param block to the top of my testing API:
[CmdletBinding()]
param()
"DebugPref: $DebugPreference"
"VerbosePref: $VerbosePreference"
I’ve attempted to pass /endpoint?Debug
or /endpoint?DebugPreference='Continue'
to my endpoint. I’ve also attempted passing them in the JSON body with the same results.
Passing Debug
\ Debug=true
yields:
[13:55:27 ERR][Api][/endpoint:GET] Cannot convert 'System.String' to the type 'System.Management.Automation.SwitchParameter' required by parameter 'Debug'.
Passing DebugPreference='Continue'
I would expect to get an error like this since it’s a variable and not a Parameter, but thought I’d give it a try.
[13:57:41 ERR][Api][/endpoint:GET] A parameter cannot be found that matches parameter name 'DebugPreference'.
Any help\guidance would be appreciated.