PowerShell / SecretManagement

PowerShell module to consistent usage of secrets through different extension vaults
MIT License
317 stars 46 forks source link

Verbose output for Get-Secret is incorrect #200

Open joshuabennett-com opened 1 year ago

joshuabennett-com commented 1 year ago

Prerequisites

Steps to reproduce

Get a secret that doesn't exist.

PS C:\Scripts> Get-Secret -Name 'blalba' or PS C:\Scripts> Get-Secret -Name 'blalba' -Vault "impactAutomation"

Expected behavior

Verbose should not report success if the secret doesn't exist.

Actual behavior

VERBOSE: Secret information was successfully retrieved from vault ImpactAutomation.

Error details

VERBOSE: Secret information was successfully retrieved from vault ImpactAutomation.
Get-Secret : The secret blalba was not found.
At line:1 char:1
+ Get-Secret -Name 'blalba'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...etSecretCommand:GetSecretCommand) [Get-Secret], ItemNotFoundException
    + FullyQualifiedErrorId : GetSecretNotFound,Microsoft.PowerShell.SecretManagement.GetSecretCommand

Environment data

Name                           Value
----                           -----
PSVersion                      5.1.19041.1320
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1320
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Version

None

Visuals

No response