PowerShellGetv2 icon indicating copy to clipboard operation
PowerShellGetv2 copied to clipboard

Find-DscResource does not support -Credential

Open RemcoKapinga opened this issue 7 years ago • 1 comments

When using a private repository (for example, a VSTS / NuGet based repository), using Credentials is required. Find-Module and Find-Script support the use of a -Credential parameter, while Find-DscResource does not. Using a private repository for DscResources is not possible.

Expected Behavior

It would be expected that Find-DscResource takes a -Credential parameter

Find-DscResource -Name MyResource -Repository Private -Credential $credential

Current Behavior

Find-DscResource does not support -Credential

Without -Credential:

PS > Find-DscResource -Repository Dummy
WARNING: Cannot access 'https://my.pkgs.visualstudio.com/_packaging/Dummy/nuget/v2/'. Are you missing 'Credential'
parameter in the cmdlet?
WARNING: Unable to resolve package source 'https://my.pkgs.visualstudio.com/_packaging/Dummy/nuget/v2/'.

With -Credential:

PS > Find-DscResource -Repository Dummy -Credential $credential
Find-DscResource : A parameter cannot be found that matches parameter name 'Credential'.
At line:1 char:54
+ ... d-DscResource -Repository Dummy -Credential $credential ...
+                                     ~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Find-DscResource], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Find-DscResource

Possible Solution

Support providing credentials on Find-DscResource, equal to Find-Module or Find-Script.

Context

Working with a private VSTS / NuGet based repository, requiring credentials (a personal access token.

RemcoKapinga avatar Apr 06 '18 11:04 RemcoKapinga

It appears this is important accross the board. I would like to use private feeds for provisioning Azure resources with DSC. I'm limited to the PS Gallery.

https://github.com/PowerShell/PowerShellGet/tree/development/DSC/Examples

The cmdlets that are wrapped here support a PSCredential object and Azure Automation supports PSCredentials. Would be great if the arguments for the DSC matched the cmdlets they wrap.

cpumanaz avatar Jun 26 '19 18:06 cpumanaz