PowerShell / PowerShell/PSResourceGet

Cannot use output from `Get-SecretInfo` in `-CredentialInfo` parameter (no cast from `SecretInformation` to `PSCredentialInfo`)

Open
#1,556 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Area-PSRepository feature_request
Dominant language
C#
Stars
576
Forks
114
Avg merge
1d 2h
Merged PRs (30d)
7

Description

Prerequisites
  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.
Steps to reproduce
  • Register a secret store per SecretStore/SecretManagement module
  • Register a repository with PSResourceGet via Register-PSResourceRepository
  • Call Set-PSResourceRepository -Name <repo> -CredentialInfo (Get-SecretInfo -Vault <vault> -Name <secret>)
Expected behavior
PS> Set-PSResourceRepository -Name Artifactory -CredentialInfo (Get-SecretInfo -Vault "Default" -Name "Artifactory")
PS> # no error
Actual behavior
PS> Set-PSResourceRepository -Name Artifactory -CredentialInfo (Get-SecretInfo -Vault "Default" -Name "Artifactory")
Set-PSResourceRepository : Cannot bind parameter 'CredentialInfo'. Cannot convert the "Microsoft.PowerShell.SecretManagement.SecretInformation" value of type "Microsoft.PowerShell.SecretManagement.SecretInformation" to type
"Microsoft.PowerShell.PSResourceGet.UtilClasses.PSCredentialInfo".
At line:1 char:93
+ ... dentialInfo (Get-SecretInfo -Vault "Default" -Name "Artifactory") ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Set-PSResourceRepository], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.PSResourceGet.Cmdlets.SetPSResourceRepository
Error details
Set-PSResourceRepository : Cannot bind parameter 'CredentialInfo'. Cannot convert the "Microsoft.PowerShell.SecretManagement.SecretInformation" value of type "Microsoft.PowerShell.SecretManagement.SecretInformation" to type
"Microsoft.PowerShell.PSResourceGet.UtilClasses.PSCredentialInfo".
At line:1 char:93
+ ... dentialInfo (Get-SecretInfo -Vault LocalUser_Auto -Name Artifactory_a ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Set-PSResourceRepository], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.PSResourceGet.Cmdlets.SetPSResourceRepository
Environment data
PS> Get-Module Microsoft.PowerShell.PSResourceGet; $PSVersionTable | ft

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Binary     1.0.2      Microsoft.PowerShell.PSResourceGet  {Find-PSResource, Get-InstalledPSResource, Get-PSResourceRepository, Get-PSScriptFileInfo...}



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

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the parameter-binding failure with Set-PSResourceRepository and Get-SecretInfo using the environment details in the issue. Trace how the CredentialInfo parameter handles SecretInformation values; done means the documented command accepts the output without a conversion error.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.