PowerShell / PowerShell/PSResourceGet
Can't publish a module to GitHub Enterprise server packages with Publish-PSResource
@anamnavi is already working on this.
Since Jan 29, 2024.
- Dominant language
- C#
- Stars
- 576
- Forks
- 114
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 7
Description
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
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.