Closed JanosPesti closed 2 months ago
Can a check be included and if PS version is less than 6, don't put in the SkipCertificateCheck in the payload? like this in line 150 of Connect-Rubrik.ps1
if (Test-PowerShellSix) {
$RestSplat = @{
Method = 'Post'
ContentType = "application/json"
URI = "https://$Server/api/v1/service_account/session"
SkipCertificateCheck = $true
Body = @{
serviceAccountId = "$($Id)"
secret = "$($Secret)"
} | ConvertTo-Json
}
}
else {
$RestSplat = @{
Method = 'Post'
ContentType = "application/json"
URI = "https://$Server/api/v1/service_account/session"
Body = @{
serviceAccountId = "$($Id)"
secret = "$($Secret)"
} | ConvertTo-Json
}
}
$response = Invoke-RestMethod @RestSplat -Verbose
I tested on ps 5.1 and 7 and it works, however I have root signed SSL certs installed. need a test on insecure connections.
Looks like this was fixed here: https://github.com/rubrikinc/rubrik-sdk-for-powershell/commit/004c450ef712a8701ec8ac43c7fccb0071cb492d
When will this be released?
This has been merged.
Current Behavior
PowerShell When using Windows PowerShell 5.1, Rubrik module 6.0.1 and service accounts, the Connect-Rubrik command gives an error related to
On PowerShell 7 it works fine. Verbose output on PS 5.1:
Expected Behavior
Not throw an error and store a token in $global:RubrikConnection Like on PowerShell 7
Steps to Reproduce
Start Windows PowerShell 5.1
Context
Failure Logs
No response