rmbolger / Posh-IBWAPI

PowerShell module for interacting with the Infoblox WAPI (REST API).
MIT License
54 stars 8 forks source link

Feature request - add switch to Set-IBConfig which will bypass proxy or set no proxy #66

Open pubsquash opened 7 months ago

pubsquash commented 7 months ago

Hi I have found in our environment the proxy had to be disabled / bypassed with various PS code, in order to get the module to work.

Proxy Bypassing, To bypass the proxy (use the direct connection), set it to null:

PS5.1

[System.Net.HttpWebRequest]::DefaultWebProxy = New-Object System.Net.WebProxy($null)

PS7+

[System.Net.Http.HttpClient]::DefaultProxy = New-Object System.Net.Webproxy($null)

Would it be possible to implement this in the module with a switch to the Set-IBConfig command, similar to the -SkipCertificateCheck

Regards

rmbolger commented 7 months ago

Hi @pubsquash, thanks for reaching out. Proxy support in the PowerShell web cmdlets has seemingly always been kind of a pain from what I can tell. I'll see what I can do though.

pubsquash commented 7 months ago

Great thanks! Also getting this issue if running under an automation account, the Set-IBConfig call errors out:

Error occurred: System.Management.Automation.ParameterBindingValidationException: Cannot bind argument to parameter 'Message' because it is null. at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception) at System.Management.Automation.Interpreter.ActionCallInstruction2.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0) at System.Management.Automation.PSScriptCmdlet.RunClause(Action1 clause, Object dollarUnderbar, Object inputToProcess) at System.Management.Automation.PSScriptCmdlet.DoEndProcessing() at System.Management.Automation.CommandProcessorBase.Complete()

But if I run a direct Invoke-webRequest with the automation account, all ok. Hope you can assist.

Regards

rmbolger commented 5 months ago

Sorry for the delay. Totally lost track of this. I can't say I've seen that error before. What sort of automation account is this?