rubrikinc / rubrik-powershell-sdk

The Rubrik Security Cloud SDK
https://www.powershellgallery.com/packages/RubrikSecurityCloud
MIT License
8 stars 9 forks source link

Authentication Error #111

Open mattcoker20 opened 7 months ago

mattcoker20 commented 7 months ago

Current Behavior

PS C:\Windows\system32> Connect-Rsc -ServiceAccountFile C:\Users\user\Documents\WindowsPowerShell\rubrik-powershell-sdk\rsc_service_account_default.xml
Connect-Rsc : One or more errors occurred.
At line:1 char:1
+ Connect-Rsc -ServiceAccountFile C:\Users\user\Documents\Windo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : AuthenticationError: (:) [Connect-Rsc], AggregateException
    + FullyQualifiedErrorId : UnableToAuthenticateToRubrikSecurityCloud,RubrikSecurityCloud.PowerShell.Cmdlets.Connect_Rsc

Expected Behavior

Connect to RSC but does not work. Tried creating a new service account but does not work

Steps to Reproduce

No response

Context

No response

Failure Logs

No response

SahFari commented 5 months ago

I have RubrikSecurityCloud version 1.4 installed at this works.
$ServiceAccountFile = 'C:\Users\xxxxx\Documents\WindowsPowerShell\rubrik-powershell-sdk\rsc_service_account_default.xml'

Connect-Rsc -ServiceAccountFile $ServiceAccountFile

Maybe it works beacuse I had this done earlier? Set-RscServiceAccountFile -InputFilePath C:\Temp\MyServiceAccount.json

keenerb commented 3 months ago

I'm having the same problem, or a very similar one.

I created an encrypted account file, and documentation reports that "connect-rsc" should simply work.

PS U:> connect-rsc connect-rsc : One or more errors occurred. At line:1 char:1

I felt it may be related to the file having been created on a mapped drive letter, so I copied it locally and tried the security file command:

PS U:> connect-rsc -ServiceAccountFile C:\JSON\rsc_service_account_default.xml connect-rsc : One or more errors occurred. At line:1 char:1

SahFari commented 3 months ago

Can you recreated the rsc_service_account_default.xml file?

If you run Set-RscServiceAccountFile -InputFilePath C:\ .... the rsc_service_account_default.xml gets recreated here: C:\Users\YourUsername\Documents\PowerShell\rubrik-powershell-sdk.

You need to either overwite the xml-file , or as did as a test, rename the old file.

Connect-Rsc -ServiceAccountFile $ServiceAccountFile or Connect-Rsc should work.

I ususally run Connect-Rsc -IfNeeded | Out-Null but I have tested Connect-Rsc -ServiceAccountFile $ServiceAccountFile as well.