rubrikinc / rubrik-sdk-for-powershell

Rubrik Module for PowerShell
https://build.rubrik.com/sdks/powershell/
MIT License
102 stars 87 forks source link

Disconnect-Rubrik not working after PowerShell 7.3.9 #853

Closed terjedahle closed 2 months ago

terjedahle commented 4 months ago

Current Behavior

After succesfull export of database by use of the PowerShell-API, we call the disconnect function Disconnect-Rubrik. On Powershell versions greater than 7.3.9 this error is returned:

Invoke-WebRequest: C:\Program Files\WindowsPowerShell\Modules\Rubrik\Private\Invoke-RubrikWebRequest.ps1:28
Line |
28 | … $result = Invoke-WebRequest -UseBasicParsing -SkipCertificateCheck …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| The given key 'Content-Type' was not present in the dictionary.

Expected Behavior

Close connection and invalidate token used to communicate with Rubrik server

Steps to Reproduce

  1. Install latest PowerShell release 7.4.2
  2. Install Rubrik-SDK 6.0.1 or 9.0.0
  3. Connect-Rubrik -Server $cluster -Id $serviceAccountId -Secret $secret
  4. Disconnect-Rubrik -Server $cluster

Context

No response

Failure Logs

No response

terjedahle commented 3 months ago

Hi, could you please fix this issue soon, as it prevents us from being on the last version of PowerShell. It was reported 42 days ago, and still no person is assigned to fix it.

jairulez commented 2 months ago

try using this as a workaround. Invoke-RestMethod -Uri https:///api/v1/session/me -Method DELETE -Header $RubrikConnections[0].header -SkipCertificateCheck

terjedahle commented 2 months ago

Hi, i have tried the workaround sugested by jairulez but it is not working for us. I get the Error : Request needs authentication! and i dont want to run with the parameter -SkipCertificateCheck in production

terjedahle commented 2 months ago

I am looking forward to the release of the changes done by mwpreston

terjedahle commented 2 months ago

Hi Mike Preston! I can see you have fixed this issue, do you have a link where i can download the new rubrik-sdk module? Version 9.0.1 ?