pspete / psPAS

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

Store Token on a Per-URL basis #198

Closed steveredden closed 5 years ago

steveredden commented 5 years ago

Is your feature request related to a problem? Please describe. Our organization is forced into having multiple vault / EPV servers, with unique URLs. In the v3 implementation, the BaseURI/Token/WebSession are stored at the Script scope, meaning multiple connections would just overwrite the previous one. I cannot have multiple connections open to a PVWA (or any other PVWAs) at once.

Describe the solution you'd like Be able to store multiple connections in memory/script scope (perhaps store in a hash), and tell the psPAS functions (new param [with default]) which connection I want to perform the functions against

Describe alternatives you've considered I can have two powershell clients open (thus with different Script -scoped variables) and run my scripts twice

Additional context N/A

pspete commented 5 years ago

Hi @steveredden - This feature is already present via Use-PASSession & Get-PASSession.

See the following example: https://github.com/pspete/psPAS#api-sessions If this does not cover the requirement, or there is an additional scenario which needs considering let me know. Historically, psPAS worked the way it did (with the $token variable) as I had the same environment requirements (multiple vaults/URLs/environments), so have attempted to provide a way to allow workflows which require interaction with different environments whilst using the same PowerShell session. Using multiple PowerShell consoles, as per the alternative you list, works well for segregated/independent requests (i.e. multiple, separate module scopes).

steveredden commented 5 years ago

Thank you for pointing me towards that! That will allow the compatibility I need :)