Skip to content

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

@PalmEmanuel

Description

@PalmEmanuel

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions