rubrikinc / rubrik-sdk-for-powershell

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

sdk compatibility (Remove-RubrikDatabaseMount) with pwsh 7.4.0 #843

Closed SahFari closed 2 months ago

SahFari commented 9 months ago

Current Behavior

Remove-RubrikDatabaseMount doesn't work with PowerShell 7.4.0,

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

Expected Behavior

Unmount the mounted database using Remove-RubrikDatabaseMount

Steps to Reproduce

Install/update Powershell 7.4.0

Uninstall PS 7.4.0 and reinstall PS 7.3.9. to be able to unmount (run Remove-RubrikDatabaseMount)

Context

I had to remove PS 7.4.0 and reinstall PS 7.3.9 to be able to unmount moundted databases.

It works fine with PS 7.3.9.

PSVersion                     : 7.3.9
PSEdition                     : Core
GitCommitId                   : 7.3.9
OS                            : Microsoft Windows 10.0.19045
Platform                      : Win32NT
PSCompatibleVersions          : {1.0, 2.0, 3.0, 4.0…}       
PSRemotingProtocolVersion     : 2.3
SerializationVersion          : 1.1.0.1
WSManStackVersion             : 3.0
HostConsoleName               : Visual Studio Code Host     
HostConsoleVersion            : 2023.8.0
HostCulture                   : sv-SE
HostCultureUI                 : sv-SE
RubrikConnection              : True
UserAgentString               : RubrikPowerShellSDK-6.0.1--7.3.9--platform--Win32NT--platform_version--Microsoft Windows 10.0.19045
RubrikAuthentication          : Bearer
RubrikClusterVersion          : 8.1.3-p3-24955
RubrikCurrentModuleVersion    : 6.0.1
RubrikInstalledModule         : 6.0.1, 6.0.1
RubrikModuleOptions           : ApplyCustomViewDefinitions = True; CredentialPath = ; DefaultWebRequestTimeOut = 300
RubrikModuleDefaultParameters :

Failure Logs

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

rik-e commented 6 months ago

Also happens with PowerShell 7.4.1 and the Disconnect-Rubrik CMDlet.

Results in Scripts not working due to max number of token reached.

TerminatingError(): "A single connection with Connect-Rubrik is required." TerminatingError(Invoke-RestMethod): "{"errorType":"user_error","message":"Max of 10 API Tokens reached.","cause":null}"

rik-e commented 4 months ago

@mwpreston, you can take a look at this? You seem to be the only one who is still active here. Unfortunately, the module cannot be used at the moment. Is a new version planned?

SahFari commented 4 months ago

I don’t think that they want us to use Rubrik cmdlet anymore ☹ I am testing the new SDK, RubrikSecurityCloud cmdlet.

Unmount

$MssqlLiveMount = Get-RscMssqlLiveMount Remove-RscMssqlLiveMount -MssqlLiveMount $MssqlLiveMount Get-RscMssqlLiveMount | Remove-RscMssqlLiveMount -Force

To run any script against RSC one need to create Service Accounts in RSC. I am struggling to run the script remotely as a specific Service Account.  

mwpreston commented 2 months ago

@rik-e - @SahFari - There is a fix for this in an upcoming PR, just knocking off a few more issues to get as much bundled as I can. With 7.4.2, MS changed something that requires a ContentType on Invoke-WebRequest when using DELETE methods - this has been added and will be merged to devel soon, master shortly thereafter