Awareness of current vault name.
Suggestion.
Can we get an awareness of the current vault name ?
Currently, we have the vault parameters available through $AdditionalParameters.
The use case is for any additional functions shipped with the module.
For instance, the module I am currently working on: , SecretManagement.LastPass
Get-Secret will do attempt to authenticate the user if not connected but if everything fail, it will throw an error
Error: Could not find decryption key. Perhaps you need to login with Connect-LastPass
Connect-LastPass is a complimentary function shipping with the module so the user do not have to make or know the underlying call. It uses $Vault parameter, even though in the root module so it can get vault parameters and respect the registered vault implementation.
What I'd really want to throw from Get-Secret is :
# The current vault name is not available from within cmdlets so I cannot indicate it from within.
Error: Could not find decryption key. Perhaps you need to login with Connect-LastPass -Vault 'CurrentVaultName'
That would requires me to be aware of which vault I am in when I throw the error from within Get-Secret and not just the $AdditionalParameters
Issue-Label Bot is automatically applying the label feature_request to this issue, with a confidence of 0.66. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!
Links: app homepage, dashboard and code for this bot.
@itfranck The vaultname gets passed to the $VaultName parameter for all commands.
What I'd recommend instead of a COnnect-LastPass running separately is to at the beginning of all of your commands, call either Test-SecretVault or a separate function that, if the vault isn't connected, initiate the login/connect process. That's what I do with the Keepass module.