Create a PowerShell Modules Gallery - Problems


#1

I’m trying to create a PowerShell Modules repository in Nexus 3 and I’m having issues with authentication.

The repository has been setup as a hosted nuget repository with anonymous access turned off.

When I use nuget.exe to manage the repository it seems to work fine. However, when I try to register the repository with PowerShell using the command:

register-psrepository -Name 'RepoName' -SourceLocation https://something:8443/repository/powershellmodules/ -PublishLocation https://something:8443/repository/powershellmodules/ -Credential (Get-Credential) -InstallationPolicy Trusted -PackageManagementProvider nuget

It prompts for username and password which I enter and I get this error:

WARNING: Unable to resolve package source 'https://something:8443/repository/powershellmodules/'

Any subsequent attempt using Find-Module or Install-Module fails.

Now I know this is perhaps a PowerShell issue but I wanted to check if anybody else has set this up? I did find a blog post stating that Anonymous access has to be turned on but it appears that PowerShellGet doesn’t need this anymore.

Any help appreciated.


#2

I wanted to update this myself as I seem to have found the issue.

The problem is that there is an issue with PowerShellGet at the moment that doesn’t allow it to work with authenticated feed normally. Each command you use must have the -Credential parameter added so that you can authenticate to the repository.

Hopefully that will be fixed in a future version!