Closed steveredden closed 5 years ago
Hi @steveredden -
This feature is already present via Use-PASSession
& Get-PASSession
.
Get-PASSession
lets the auth token, url etc be obtained from the module scope and assigned to a local variable.Use-PASSession
lets an auth token & url etc (obtained through Get-PASSession
) be assigned into the module scope for subsequent psPAS requests.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).
Thank you for pointing me towards that! That will allow the compatibility I need :)
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