Tss Session timed out #199
-
Hi, I am trying to manage about 20k secrets and usually, the TSS Session would time out before my scripts could complete. is there a way to extend a timeout for a session? My next approach is to break it into smaller batches. Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It will depend on what authentication type you are using in reference to using the module's methods. A token itself in Secret Server only lasts as long as the configured timeout, which defaults to 20 minutes. Various things can require that timeout to be increased to an acceptable time but overall 20 minutes in large environments that utilize the REST API is not going to be sufficient. In addition to that, we also support the use of a Refresh Token, which default allows you to request 3 as max. This would mean if you authenticated using OAuth2 (username/password) you get an initial token (good for 20 minutes) and then refresh it up to 3 times. That gives you around 1.5 hours of processing time. As it pertains to the module, I've added a method on the TssSession object called foreach ($secret in $secrets {
if ($Session.CheckTokenTtl('minutes',5)) {
Write-TssLog @logInfoParam -Message "Token nearing expiration, attempting to renew"
try {
$null = $Session.SessionRefresh()
} catch {
Write-TssLog @logFatalParam -Message "$currentCommand | [$folderName] | Unable to refresh token: $($_)"
Write-Error "Unable to refresh token"
break
}
Write-TssLog @logInfoParam -Message "Token nearing expiration, renewed"
}
# do some processing
} The |
Beta Was this translation helpful? Give feedback.
It will depend on what authentication type you are using in reference to using the module's methods. A token itself in Secret Server only lasts as long as the configured timeout, which defaults to 20 minutes. Various things can require that timeout to be increased to an acceptable time but overall 20 minutes in large environments that utilize the REST API is not going to be sufficient.
In addition to that, we also support the use of a Refresh Token, which default allows you to request 3 as max. This would mean if you authenticated using OAuth2 (username/password) you get an initial token (good for 20 minutes) and then refresh it up to 3 times. That gives you around 1.5 hours of processing…