PowerShell / PSResourceGet

PSResourceGet is the package manager for PowerShell
https://www.powershellgallery.com/packages/Microsoft.PowerShell.PSResourceGet
MIT License
483 stars 92 forks source link

Can't publish a module to GitHub Enterprise server packages with Publish-PSResource #1543

Open mark-wilson-spc opened 7 months ago

mark-wilson-spc commented 7 months ago

Prerequisites

Steps to reproduce

Register a PS Repository on GitHub Enterprise Server in Azure:

Register-PSResourceRepository -Name 'MyPSRepo' -Uri 'https://nuget.github.mydomain.com/myorg/index.json' -Trusted -Priority 30

(Note: I have tried without setting the -ApiKey parameter, and with every possible -ApiKey value. )

Attempt to publish the module:

 $ApiKey = 'ghp_redacted'
 Publish-PSResource -Repository MyPSRepo -Path 'C:\Program Files\PowerShell\Modules\MyModule' -ApiKey $ApiKey -Verbose

I have also tried with -Credential

I can perform the exact same steps against my public github.com account (with the correct -Uri) and it works, so it seems to be something unique to GitHub Enterprise.

Expected behavior

Module is published.

Actual behavior

VERBOSE: Performing the operation "Publish-PSResource" on target "Publish resource 'C:\Program Files\PowerShell\Modules\MyModule' from the machine".
VERBOSE: The newly created nuspec is: C:\Users\MyUsername\AppData\Local\Temp\1\97a05b4c-7d06-4a28-a7e4-81cea02dfe02\MyModule.nuspec
VERBOSE: Successfully packed the resource into a .nupkg
VERBOSE: Not able to publish resource to 'https://nuget.github.mydomain.com/myorg/index.json'
Publish-PSResource: Repository 'MyPSRepo': Response status code does not indicate success: 400 (Bad Request).
VERBOSE: Deleting temporary directory 'C:\Users\MyUsername\AppData\Local\Temp\1\97a05b4c-7d06-4a28-a7e4-81cea02dfe02'

Error details

No response

Environment data

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     1.0.1                 Microsoft.PowerShell.PSResourceGet  {Find-PSResource, Get-InstalledPSResource, Get-PSResourceRepository, Get-PSScriptFileInfo…}

Key   : PSVersion
Value : 7.4.1
Name  : PSVersion

Key   : PSEdition
Value : Core
Name  : PSEdition

Key   : GitCommitId
Value : 7.4.1
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