Publish-PSResource does currently not work with Azure Artifacts
See original GitHub issuePrerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
Steps to reproduce
I tried to use PowerShellGet 3.0.0-beta19 for publishing a module to a Azure DevOps Artifacts feed.
At first I tried to register the feed using the v2
endpoint. But I have seen that the cmdlet Publish-PSResource
hardcoded adds /package
to the URL, if it is a NuGet v2 endpoint, because the PowerShell gallery apparently uses this. But my Azure Artifacts feed does not have this and therefore the cmdlet fails with HTTP404.
The v2 endpoint for Azure Artifacts looks like this:
https://pkgs.dev.azure.com/<org>/<project>/_packaging/<feedname>/nuget/v2/
Then I tried to register the the PS Repository using the NuGet v3 endpoint. This however fails with this error message:
Publish-PSResource : Unable to load the service index for source https://pkgs.dev.azure.com/<org>/<project>/_packaging/<feedname>/nuget/v3/index.json.
Is there a preference which version I should use? Is this something that still needs implementing and is there a temporary workaround I can use in the meantime?
I am having a really hard time getting things to work with Azure Artifacts using PowerShellGet 2.x (older NuGet version, authentication, double repository registration) and therefore I’d prefer switchtig to PowerShellGet 3.x if possible.
Expected behavior
PowerShellGet should publish the package.
Actual behavior
Neither on the v2 nor on the v3 endpoint I seem to be able to publish the package.
Error details
Publish-PSResource : Unable to load the service index for source https://pkgs.dev.azure.com/<redacted>/<redacted>/_packaging/<redacted>/nuget/v3/index.json.
At line:1 char:1
+ Publish-PSResource -ApiKey <redacted> -Repository <redacted> -Path "C:\temp\psmod ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidResult: (:) [Publish-PSResource], ArgumentException
+ FullyQualifiedErrorId : PushNupkgError,Microsoft.PowerShell.PowerShellGet.Cmdlets.PublishPSResource
Environment data
No response
Visuals
No response
Issue Analytics
- State:
- Created 7 months ago
- Comments:7 (4 by maintainers)
Thanks @hemisphera for the investigation and the PR, we have a major refactor of this cmdlet about to go out (beta 20), so after that we can retest this and see if the issue is resolved
We recommend publishing to AzureArtifacts with a V3 protocol URI for your repository. It’s fixed now and -Credential with CredentialInfo value should work as of this next release.