question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Publish-PSResource does currently not work with Azure Artifacts

See original GitHub issue

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

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:closed
  • Created 7 months ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
SydneyhSmithcommented, Mar 6, 2023

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

0reactions
anamnavicommented, Jul 13, 2023

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Publish-Module from Azure DevOps will not publish to a V3 ...
I believe this error is due to PowerShellGet not interacting nicely with V3 Nuget repositories. I can not use V2 because when I...
Read more >
Supported repository configurations - PowerShell
With Azure Artifacts, developers can publish packages to their feeds and share it within the same team, across organizations, and even publicly.
Read more >
Recently Active 'azure-artifacts' Questions
I have publish a npm module over Azure Artifacts Feed, which works fine with he generated npmrc. I understand that I can update...
Read more >
Publish and download pipeline Artifacts - Azure
Using Azure Pipelines, you can download artifacts from earlier ... Publishing pipeline artifacts is not supported in release pipelines.
Read more >
Creating a Private PSRepository in Azure | How - PowerShell
In the Azure DevOps suite there is something called Azure Artifacts, where you can create your own package feeds for hosting published code ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found