Skip to content

Conversation

@lukeroberts
Copy link
Contributor

When using the IdentityAuth module to create headers for use in psPAS it will not work as the latest version of psPAS is looking for additional members in the $session object that is created. https://github.com/pspete/psPAS/blob/4f44ad552862c4b0b8de333993f058a1b394c40c/psPAS/psPAS.psm1#L60-L71

Here is an example without the fix:

# laroberts in wksta
 ➜  Import-Module C:\users\laroberts\Downloads\IdentityAuth_bad.psm1
# laroberts in wksta
 ➜  $header = Get-IdentityHeader -IdentityTenantURL "REDACTED.id.cyberark.cloud" -psPASFormat -PCloudSubdomain "REDACTED" -IdentityUserName "REDACTED@REDACTED.com"
Identity Token Set Successfully
# laroberts in wksta
 ➜  Use-PASSession $header
# laroberts in wksta
 ➜  Get-PASUser
Exception setting "LastCommand": "The property 'LastCommand' cannot be found on this object. Verify that the property exists and can be set."
At line:382 char:4
+             $psPASSession.LastCommand = Get-ParentFunction | Select-O ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], SetValueInvocationException
    + FullyQualifiedErrorId : ExceptionWhenSetting

Exception setting "LastCommandResults": "The property 'LastCommandResults' cannot be found on this object. Verify that the property exists and can be set."
At line:383 char:4
+             $psPASSession.LastCommandResults = $APIResponse
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], SetValueInvocationException
    + FullyQualifiedErrorId : ExceptionWhenSetting

Exception setting "LastCommandTime": "The property 'LastCommandTime' cannot be found on this object. Verify that the property exists and can be set."
At line:384 char:4
+             $psPASSession.LastCommandTime = Get-Date
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], SetValueInvocationException
    + FullyQualifiedErrorId : ExceptionWhenSetting

# laroberts in wksta
 ➜  Get-Module -ListAvailable -Name psPAS


    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     6.4.85     psPAS                               {New-PASSession, Close-PASSession, Add-PASPublicSSHKey, Get-PASPublicSSHKey...}


# laroberts in wksta
 ➜

psPAS session object requires more members to work fully
@bab29 bab29 merged commit 78b9990 into cyberark:main Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants