pspete / psPAS

PowerShell module for CyberArk Privileged Access Security REST API
https://pspas.pspete.dev
MIT License
295 stars 91 forks source link

New-PASSession does not honor "-connectionNumber" parameter #459

Closed sudipto-roychoudhury closed 1 year ago

sudipto-roychoudhury commented 1 year ago

Describe the issue While trying to call New-PASSession using local CyberArk creds along with the "-connectionNumber" parameter it errors out with message :

New-PASSession : Parameter set cannot be resolved using the specified named parameters.

To Reproduce Steps to reproduce the behavior:

  1. Retrieve local creds via CredentialRetriever module
  2. Create PSCredential Object via the ToCredentia() method
  3. Call New-PASSession with the PSCredential Object and paramter "-connectionNumber" 1

Expected behavior Successfull Authentication expected using 'connectionNumber' argument for the API.

Screenshots & Console Output If applicable, add screenshots and/or console output to help explain your problem.

New-PASSession : Parameter set cannot be resolved using the specified named parameters


<--Console Output Goes Here-->

Your Environment Include relevant details about your environment

Additional context Trying to resolve this error when a Powershell script is run to call CyberArk REST API Invoke-PASRestMethod : [401] User was automatically logged off from Vault (Diagnostic information: 540).

Ref1 : https://cyberark-customers.force.com/s/question/0D52J00006k9BOySAM/why-i-am-getting-errormessage-itacm040s-user-was-automatically-logged-off-from-vault-diagnostic-information-540logoff-from-the-vault-and-logon-again

Ref2 : https://cyberarkdocu.azurewebsites.net/Product-Doc/OnlineHelp/PAS/Latest/en/Content/SDK/CyberArkAuthentication-Logon.htm

pspete commented 1 year ago

The error message is quite clear - connectionNumber is not part of the ParameterSet being used.

The parameter description shows that it belongs to the Gen1 & Gen1Radius parameter sets. - you probably just need to additionally specify the -UseGen1API parameter.

Consider referring to your versions product documentation and investigate the Gen 2 API options available to you, the reference links provided are quite dated.

sudipto-roychoudhury commented 1 year ago

Thanks @pspete again for nudging me in the right direction. Found this bool parameter "concurrentSession" in the API docs which when set to "true" gives me the ability to run psPAS cmdlets with same user concurrently.

New-PASSession -Credential $CybLocalreds -BaseURI "https://PVWA" -concurrentSession $true