PS-NCentral icon indicating copy to clipboard operation
PS-NCentral copied to clipboard

New-NCentralConnection Issues with Az.Storage Module

Open valinortech opened this issue 3 years ago • 3 comments

I recently found that the line of code below causes some Microsoft Az module commands to throw a general exception with the message: "An error occurred while sending the request."

[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}

I received this when trying to call "Get-AzStorageTable" after using New-NCentralConnection. I was able to workaround the issue by manually setting the ServerCertificateValidationCallback to the default value of $null before using any commands in the Az.Storage module.

Workaround: [System.Net.ServicePointManager]::ServerCertificateValidationCallback = $null

valinortech avatar Sep 12 '22 18:09 valinortech

OK. I will see if I can switch this before every request and reset afterwards. Thx. for troubleshooting ;-) .

ToschAutomatisering avatar Nov 18 '22 13:11 ToschAutomatisering

This was also preventing me from running any Invoke-WebRequest or Invoke-RestMethod commands later in my script. Using the workaround after establishing the connection allows the rest of my script to work. Additional calls to the PS-NCentral module also work.

aaronh-nbit avatar Jul 18 '23 13:07 aaronh-nbit

Thx. for testing. I will remove the setting from PS-NCentral 1.6 since it does not seem to make a difference to PS-NCentral.

ToschAutomatisering avatar Jul 20 '23 07:07 ToschAutomatisering