PowerShell / PSResourceGet

PSResourceGet is the package manager for PowerShell
https://www.powershellgallery.com/packages/Microsoft.PowerShell.PSResourceGet
MIT License
483 stars 92 forks source link

Adding the Parameter -Credential to Register-PSResourceRepository #1669

Closed tinuwalther closed 1 week ago

tinuwalther commented 2 months ago

Summary of the new feature / enhancement

As a user of the PSResourceGet module I want to pass a PSCredential object (username and password) as it is possible in the PowerShellGet module, because I cannot install the Microsoft.PowerShell.SecretManagement module without a registered repository or/and without an internet connection to the PowerShell Gallery.

Proposed technical implementation details (optional)

It should be possible to use the Register-PSResourceRepository as in the following example:

[PSCredential]$cred = Get-Credential -Message 'Enter your credentials for the repository to register'

$parameters = @{
    Name = 'nexusNugetRepo'
    Uri  = 'http://localhost:8081/repository/PSModules/'
    Trusted = $true
    Priority = 50
    Credential = $cred
} 
Register-PSResourceRepository @parameters 
tinuwalther commented 2 months ago

@alerickson I discussed this with you at the PSConfEU in Antwerp at your session on container galleries

SydneyhSmith commented 1 week ago

Basically this is not required because while PowerShellGet pinged the uri at registration time, PSResourceGet does not-- therefore you can pass in the -Credential using the -Credential param at Install-PSResource time... the reason that credential persistence is not supported without SecretManagement is because there is no SecretVault to securely keep the credential in... perhaps a reason to ship SecretManagement in PowerShell 7.x