Closed dcherry88 closed 1 year ago
Token based auth and expiration pertains to TPP, not VaaS. What you got back was of type VenafiSession. You can use -PassThru, as you showed in the screenshot, and set the output to a variable to use with subsequent function calls. Easier though is to not use -PassThru and have the function set the session variable $VenafiSession which will be used by default and needed to be provided directly each time.
I understand the functionality of -passthru, I used it to display what returned data I get from it. If I attempt to store new-venafisession within a variable to reference in subsequent commands, no data is returned when you call it and if you attempt to use any command with the venafi session variable referenced you get told you need to run New-VenafiSession to provide the VaaS key or token. Picture attached to show you the result of those commands. I'm storing the API key I recieved from my account preferences in VaaS as a pscredential type using get-credential. I put random data in the username field, like my username within Venafi, and the api key as the password.
If there is something I'm missing in the documentation for this, please let me know.
If you want to use -PassThru
, you need to specify it and a variable to store the session. Otherwise, the function will store the session as $VenafiSession
.
The use of
-PassThru
and providing -VenafiSession
is not required as functions will use $VenafiSession
by default.
For your code, it should be as easy as
New-VenafiSession -VaasKey $api
Get-VaasConnector -All
or with -PassThru
$sess = New-VenafiSession -VaasKey $api -PassThru
Get-VaasConnector -All -VenafiSession $sess
I see the distinction now and confirmed it's working appropriately. Thank you for the assistance.
Environment
Steps to reproduce
Attempting to use New-VenafiSession to connect with VaaS but no data is returned by the command.
Expected behavior
Returned VenafiSession is expected.
Actual behavior
No session is established.
Screenshots
When running -passthru there is no indication of token or expiration date/time in the data.![image](https://github.com/Venafi/VenafiPS/assets/875471/9fc8c0f4-7d07-4380-a765-337ed14e03ac)