Description
EDIT: I forked in order to PR a README change, and spotted what I'd missed - d'oh! The correct commands are called out in README.md#L157 FunctionsToExport = @('Set-Secret','Get-Secret','Remove-Secret','Get-SecretInfo','Test-SecretVault')
and with #Optional
comments above the optional functions. I missed that :-( However, I still think this issue points to a possible improvement.
Following the help, I implemented an Extension script module with the following functions:
- Get-Secret
- Get-SecretInfo
- Remove-Secret
- Set-Secret
- Set-SecretInfo
However, vault registration failed:
Register-SecretVault -Name MyVault -ModuleName PasswordSafe -VaultParameters @{Id = 32048} -Verbose
VERBOSE: Performing the operation "Register module as a SecretManagement extension vault for current user" on target "MyVault".
Register-SecretVault: Could not find a SecretManagement extension implementing script module.
I inspected the source and found that Set-SecretInfo
is not a required command, but Test-SecretVault
is: https://github.com/PowerShell/SecretManagement/blob/b1fbbd0/src/code/SecretManagement.cs#L495-L511
The UX would be better if this were made clearer in the README, and/or the exact error message were propagated upwards. With NormalView, the error seen is:
Register-SecretVault : Could not find a SecretManagement extension implementing script module.
At line:1 char:1
+ Register-SecretVault -Name wham5-dev -ModuleName PasswordSafe -VaultP …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.PowerShel…rSecretVaultCommand:RegisterSecretVaultCommand) [Register-SecretVault], PSInvalidOperationException
+ FullyQualifiedErrorId : RegisterSecretVaultCantFindImplementingScriptModule,Microsoft.PowerShell.SecretManagement.RegisterSecretVaultCommand
That could potentially tell us exactly what command or parameter is missing...?