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.

Cannot publish module using `Publish-PSResource` to Azure Artifacts Nuget v3 feed

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’m having trouble publishing a module to an Azure Artifacts feed. I’ve tried various combinations of authentication, but I end up with the error Publish-PSResource: Unable to load the service index for source https://pkgs.dev.azure.com/<org>/<project>/_packaging/MyFeed/nuget/v3/index.json..

I’ve tried both with the -Credential parameter on Publish-PSResource and with -CredentialInfo on Register-PSResourceRepository as specified in the blog post, but I’m starting to think that Azure Artifacts is a different case since it does not use an API key.

I expected it to work with 3.0-beta14 and the credential / authentication improvements, is it not supported yet in PowerShellGet 3.0?

Expected behavior

PS> Import-Module PowerShellGet -MaximumVersion 3.*
PS> $FeedUrlv3 = 'https://pkgs.dev.azure.com/<org>/<project>/_packaging/MyFeed/nuget/v3/index.json'
PS> Register-PSResourceRepository -Name 'MyRepo' -Uri $FeedUrlv3
PS> Publish-PSResource -Path ".\MyModule\" -Repository MyRepo -SkipDependenciesCheck -Credential $Credential # Credential is pscredential with email as username and PAT for password.

Actual behavior

PS> Import-Module PowerShellGet -MaximumVersion 3.*
PS> $FeedUrlv3 = 'https://pkgs.dev.azure.com/<org>/<project>/_packaging/MyFeed/nuget/v3/index.json'
PS> Register-PSResourceRepository -Name 'MyRepo' -Uri $FeedUrlv3
PS> Publish-PSResource -Path ".\MyModule\" -Repository MyRepo -SkipDependenciesCheck -Credential $Credential

`Publish-PSResource: Unable to load the service index for source https://pkgs.dev.azure.com/<org>/<project>/_packaging/MyFeed/nuget/v3/index.json.`

Error details

Exception             : 
    Type    : System.ArgumentException
    Message : Unable to load the service index for source https://pkgs.dev.azure.com/<org>/<project>/_packaging/MyFeed/nuget/v3/index.json.
    HResult : -2147024809
CategoryInfo          : InvalidResult: (:) [Publish-PSResource], ArgumentException
FullyQualifiedErrorId : PushNupkgError,Microsoft.PowerShell.PowerShellGet.Cmdlets.PublishPSResource
InvocationInfo        : 
    MyCommand        : Publish-PSResource
    ScriptLineNumber : 1
    OffsetInLine     : 1
    HistoryId        : 53
    Line             : Publish-PSResource -Path ".\MyModule\" -Repository MyRepo -SkipDependenciesCheck -Credential $Credential
    PositionMessage  : At line:1 char:1
                       + Publish-PSResource -Path ".\MyModule\" -Repository MyRepo …
                       + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    InvocationName   : Publish-PSResource
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :

Environment data

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.2.5                 PowerShellGet                       {Find-Command, Find-DscResource, Find-Module, Find-RoleCapability…}
Binary     3.0.14     beta14     PowerShellGet                       {Find-PSResource, Get-PSResource, Get-PSResourceRepository, Install-PSResource…}

Key   : PSVersion
Value : 7.2.4
Name  : PSVersion


Key   : PSEdition
Value : Core
Name  : PSEdition


Key   : GitCommitId
Value : 7.2.4
Name  : GitCommitId


Key   : OS
Value : Microsoft Windows 10.0.19044
Name  : OS


Key   : Platform
Value : Win32NT
Name  : Platform


Key   : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0…}
Name  : PSCompatibleVersions


Key   : PSRemotingProtocolVersion
Value : 2.3
Name  : PSRemotingProtocolVersion


Key   : SerializationVersion
Value : 1.1.0.1
Name  : SerializationVersion


Key   : WSManStackVersion
Value : 3.0
Name  : WSManStackVersion

Visuals

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
SydneyhSmithcommented, Jun 2, 2022

Thanks @PalmEmanuel for the bug report! We will need to support additional credential types for Publish…the Credential Persistence feature is specific to read access, however it is not nearly as useful if publish functionality isnt possible 😄

1reaction
alericksoncommented, May 5, 2023

Resolved with PR #993

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 >
Connect to a feed and publish NuGet packages - NuGet.exe
Select Artifacts, and then select your feed from the dropdown menu. Select Connect to feed. A screenshot showing how to connect to a...
Read more >
Publish-Module to private Azure DevOps Artifact feed
What I want to do: - Publish a PowerShell module to a private Azure DevOps Artifact feed (nuget feed). - Using the PowerShellGet...
Read more >
Cannot push packages to azure artifacts feed, keeps ...
I've got a feed setup and I got full owner privilege's to the feed in azure artifacts. I've installed NuGet.CommandLine package to my...
Read more >
Publishing Artifacts in an Azure DevOps Release Pipeline
Learn how to take an existing Azure DevOps pipeline build artifact, package it up and publish to an Azure Artifacts NuGet feed.
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