Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install-PSResource fails with 404 for a module that Find-PSResource was able to find #1491

Open
3 tasks done
nbarnwell opened this issue Dec 8, 2023 · 7 comments
Open
3 tasks done
Assignees

Comments

@nbarnwell
Copy link

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

  1. Followed the documentation for setting up an authenticated repository
  2. Check a package on the authenticated feed is available: Find-PSResource -Repository MyPowerShellModules -name My.PowerShell.Utility
  3. Attempt to install the module: Install-PSResource -Name My.PowerShell.Utility -Repository MyPowerShellModules

Expected behavior

Module is installed and available to use.

Actual behavior

Failure with error message.

Error details

Install-PSResource: 'Response status code does not indicate success: 404 (Not Found).' Request sent: 'https://my.pkgs.visualstudio.com/DevOps/_packaging/MyPowerShellModules/nuget/v2/package/My.PowerShell.Utility/0.9.6'

Environment data

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

Key   : PSVersion
Value : 7.4.0
Name  : PSVersion


Key   : PSEdition
Value : Core
Name  : PSEdition


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

@anamnavi
Copy link
Member

anamnavi commented Jan 8, 2024

@nbarnwell thanks for sharing this issue! Could you please provide output of the command you ran and add -Verbose to that command and we will look into this, thanks!

@nbarnwell
Copy link
Author

I've got some output here:

PS C:\Users\Teatowel> Install-PSResource MyCompany.PowerShell.Utility -Verbose
VERBOSE: All paths to search: 'C:\Users\Teatowel\Documents\PowerShell\Modules'
VERBOSE: All paths to search: 'C:\Users\Teatowel\Documents\PowerShell\Scripts'
VERBOSE: Retrieving directories in the path 'C:\Users\Teatowel\Documents\PowerShell\Modules'
VERBOSE: Retrieving directories in the path 'C:\Users\Teatowel\Documents\PowerShell\Scripts'
VERBOSE: All paths to search: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.PSResourceGet'
VERBOSE: All paths to search: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretManagement'
VERBOSE: All paths to search: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretStore'
VERBOSE: All paths to search: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PowerShellGet'
VERBOSE: credential successfully read from vault and set for repository: MyCompanyPowerShellModules
VERBOSE: Attempting to search for packages in 'MyCompanyPowerShellModules'
VERBOSE: Performing the operation "Install-PSResource" on target "Package to install: 'MyCompany.PowerShell.Utility', version: '0.9.6'".
VERBOSE: Attempting to delete 'C:\Users\Teatowel\AppData\Local\Temp\f8b8b660-e3ca-4b5c-b8e3-1a528744f844'
VERBOSE: Successfully deleted 'C:\Users\Teatowel\AppData\Local\Temp\f8b8b660-e3ca-4b5c-b8e3-1a528744f844'
Install-PSResource: 'Response status code does not indicate success: 404 (Not Found).' Request sent: 'https://MyCompany.pkgs.visualstudio.com/DevOps/_packaging/MyCompanyPowerShellModules/nuget/v2/package/MyCompany.PowerShell.Utility/0.9.6'

Here's the output for Find-PSResource:

PS C:\Users\Teatowel> Find-PSResource MyCompany.PowerShell.Utility -Verbose
VERBOSE: credential successfully read from vault and set for repository: MyCompanyPowerShellModules

VERBOSE: Package with name 'MyCompany.PowerShell.Utility' could not be found in repository 'PSGallery'.
Name                     Version Prerelease Repository             Description
----                     ------- ---------- ----------             -----------
MyCompany.PowerShell.Utility 0.9.6              MyCompanyPowerShellModules Utility functions useful in lots of places.

@nbarnwell
Copy link
Author

It's possible it's to do with upstream dependencies, or possibly the version of nuget API that it supports? Here's an example with the debug output:

PS C:\temp> Install-PSResource PSWindowsUpdate -Debug
VERBOSE: All paths to search: 'C:\Users\Teatowel\Documents\PowerShell\Modules'

Confirm
Continue with this operation?
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help (default is "Y"): a
VERBOSE: All paths to search: 'C:\Users\Teatowel\Documents\PowerShell\Scripts'
VERBOSE: Retrieving directories in the path 'C:\Users\Teatowel\Documents\PowerShell\Modules'
VERBOSE: Retrieving directories in the path 'C:\Users\Teatowel\Documents\PowerShell\Scripts'
VERBOSE: All paths to search: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.PSResourceGet'
VERBOSE: All paths to search: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretManagement'
VERBOSE: All paths to search: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretStore'
VERBOSE: All paths to search: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PackageManagement'
VERBOSE: All paths to search: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PowerShellGet'
VERBOSE: All paths to search: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PSScriptAnalyzer'
DEBUG: In GetHelper::GetPackagesFromPath()
DEBUG: In GetHelper::FilterPkgPathsByName()
DEBUG: In GetHelper::FilterPkgPathsByVersion()
DEBUG: Searching through package path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.PSResourceGet'
DEBUG: Searching through package path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.PSResourceGet'
DEBUG: Searching through package version path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.PSResourceGet\1.0.2'
DEBUG: Package version parsed as NuGet version: '1.0.2'
DEBUG: Reading package metadata from: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.PSResourceGet\1.0.2\PSGetModuleInfo.xml'
DEBUG: Searching through package path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretManagement'
DEBUG: Searching through package path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretManagement'
DEBUG: Searching through package version path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretManagement\1.1.2'
DEBUG: Package version parsed as NuGet version: '1.1.2'
DEBUG: Reading package metadata from: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretManagement\1.1.2\PSGetModuleInfo.xml'
DEBUG: Searching through package path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretStore'
DEBUG: Searching through package path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretStore'
DEBUG: Searching through package version path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretStore\1.0.6'
DEBUG: Package version parsed as NuGet version: '1.0.6'
DEBUG: Reading package metadata from: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretStore\1.0.6\PSGetModuleInfo.xml'
DEBUG: Searching through package path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PackageManagement'
DEBUG: Searching through package path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PackageManagement'
DEBUG: Searching through package version path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PackageManagement\1.4.4'
DEBUG: Package version parsed as NuGet version: '1.4.4'
DEBUG: Reading package metadata from: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PackageManagement\1.4.4\PSGetModuleInfo.xml'
DEBUG: Searching through package path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PowerShellGet'
DEBUG: Searching through package path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PowerShellGet'
DEBUG: Searching through package version path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PowerShellGet\2.2.5'
DEBUG: Package version parsed as NuGet version: '2.2.5'
DEBUG: Reading package metadata from: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PowerShellGet\2.2.5\PSGetModuleInfo.xml'
DEBUG: Searching through package path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PSScriptAnalyzer'
DEBUG: Searching through package path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PSScriptAnalyzer'
DEBUG: Searching through package version path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PSScriptAnalyzer\1.21.0'
DEBUG: Package version parsed as NuGet version: '1.21.0'
DEBUG: Reading package metadata from: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PSScriptAnalyzer\1.21.0\PSGetModuleInfo.xml'
DEBUG: In InstallPSResource::ProcessInstallHelper()
DEBUG: In InstallHelper::BeginInstallPackages()
DEBUG: Parameters passed in >>> Name: 'PSWindowsUpdate'; VersionRange: ''; NuGetVersion: ''; VersionType: 'NoVersion'; Version: ''; Prerelease: 'False'; Repository: ''; AcceptLicense: 'False'; Quiet: 'False'; Reinstall: 'False'; TrustRepository: 'False'; NoClobber: 'False'; AsNupkg: 'False'; IncludeXml 'True'; SavePackage 'False'; TemporaryPath ''; SkipDependencyCheck: 'False'; AuthenticodeCheck: 'False'; PathsToInstallPkg: 'C:\Users\Teatowel\Documents\PowerShell\Modules,C:\Users\Teatowel\Documents\PowerShell\Scripts'; Scope 'CurrentUser'
DEBUG: In InstallHelper::ProcessRepositories()
VERBOSE: credential successfully read from vault and set for repository: MyCompanyPowerShell
VERBOSE: Attempting to search for packages in 'MyCompanyPowerShell'
DEBUG: In InstallHelper::InstallPackages()
DEBUG: In InstallHelper::InstallPackage()
DEBUG: In V2ServerAPICalls::FindName()
DEBUG: In V2ServerAPICalls::HttpRequestCall()
DEBUG: Request url is 'https://pkgs.dev.azure.com/MyCompany/_packaging/MyCompanyPowerShell/nuget/v2/FindPackagesById()?id='PSWindowsUpdate'&$inlinecount=allpages&$filter=IsLatestVersion and Id eq 'PSWindowsUpdate''

Confirm
Are you sure you want to perform this action?
Performing the operation "Install-PSResource" on target "Package to install: 'PSWindowsUpdate', version: '2.2.1.4'".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): a
DEBUG: In V2ServerAPICalls::InstallVersion()
DEBUG: In V2ServerAPICalls::HttpRequestCallForContent()
DEBUG: Request url is 'https://pkgs.dev.azure.com/MyCompany/_packaging/MyCompanyPowerShell/nuget/v2/package/PSWindowsUpdate/2.2.1.4'
VERBOSE: Attempting to delete 'C:\Users\Teatowel\AppData\Local\Temp\bb091ead-6ffd-4de7-80c6-d512fcbd42b0'
VERBOSE: Successfully deleted 'C:\Users\Teatowel\AppData\Local\Temp\bb091ead-6ffd-4de7-80c6-d512fcbd42b0'
Install-PSResource: 'Response status code does not indicate success: 404 (Not Found).' Request sent: 'https://pkgs.dev.azure.com/MyCompany/_packaging/MyCompanyPowerShell/nuget/v2/package/PSWindowsUpdate/2.2.1.4'

@nbarnwell
Copy link
Author

I think it almost worked with a v3 URL. Note the specific WARNING, though:

WARNING: Installing dependencies is not currently supported for V3 server protocol repositories. The package will be installed without installing dependencies.
PS C:\temp> install-PSResource PSWindowsUpdate -Debug
VERBOSE: All paths to search: 'C:\Users\Teatowel\Documents\PowerShell\Modules'

Confirm
Continue with this operation?
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help (default is "Y"): a
VERBOSE: All paths to search: 'C:\Users\Teatowel\Documents\PowerShell\Scripts'
VERBOSE: Retrieving directories in the path 'C:\Users\Teatowel\Documents\PowerShell\Modules'
VERBOSE: Retrieving directories in the path 'C:\Users\Teatowel\Documents\PowerShell\Scripts'
VERBOSE: All paths to search: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.PSResourceGet'
VERBOSE: All paths to search: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretManagement'
VERBOSE: All paths to search: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretStore'
VERBOSE: All paths to search: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PackageManagement'
VERBOSE: All paths to search: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PowerShellGet'
VERBOSE: All paths to search: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PSScriptAnalyzer'
DEBUG: In GetHelper::GetPackagesFromPath()
DEBUG: In GetHelper::FilterPkgPathsByName()
DEBUG: In GetHelper::FilterPkgPathsByVersion()
DEBUG: Searching through package path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.PSResourceGet'
DEBUG: Searching through package path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.PSResourceGet'
DEBUG: Searching through package version path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.PSResourceGet\1.0.2'
DEBUG: Package version parsed as NuGet version: '1.0.2'
DEBUG: Reading package metadata from: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.PSResourceGet\1.0.2\PSGetModuleInfo.xml'
DEBUG: Searching through package path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretManagement'
DEBUG: Searching through package path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretManagement'
DEBUG: Searching through package version path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretManagement\1.1.2'
DEBUG: Package version parsed as NuGet version: '1.1.2'
DEBUG: Reading package metadata from: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretManagement\1.1.2\PSGetModuleInfo.xml'
DEBUG: Searching through package path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretStore'
DEBUG: Searching through package path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretStore'
DEBUG: Searching through package version path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretStore\1.0.6'
DEBUG: Package version parsed as NuGet version: '1.0.6'
DEBUG: Reading package metadata from: 'C:\Users\Teatowel\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretStore\1.0.6\PSGetModuleInfo.xml'
DEBUG: Searching through package path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PackageManagement'
DEBUG: Searching through package path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PackageManagement'
DEBUG: Searching through package version path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PackageManagement\1.4.4'
DEBUG: Package version parsed as NuGet version: '1.4.4'
DEBUG: Reading package metadata from: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PackageManagement\1.4.4\PSGetModuleInfo.xml'
DEBUG: Searching through package path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PowerShellGet'
DEBUG: Searching through package path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PowerShellGet'
DEBUG: Searching through package version path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PowerShellGet\2.2.5'
DEBUG: Package version parsed as NuGet version: '2.2.5'
DEBUG: Reading package metadata from: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PowerShellGet\2.2.5\PSGetModuleInfo.xml'
DEBUG: Searching through package path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PSScriptAnalyzer'
DEBUG: Searching through package path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PSScriptAnalyzer'
DEBUG: Searching through package version path: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PSScriptAnalyzer\1.21.0'
DEBUG: Package version parsed as NuGet version: '1.21.0'
DEBUG: Reading package metadata from: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PSScriptAnalyzer\1.21.0\PSGetModuleInfo.xml'
DEBUG: In InstallPSResource::ProcessInstallHelper()
DEBUG: In InstallHelper::BeginInstallPackages()
DEBUG: Parameters passed in >>> Name: 'PSWindowsUpdate'; VersionRange: ''; NuGetVersion: ''; VersionType: 'NoVersion'; Version: ''; Prerelease: 'False'; Repository: ''; AcceptLicense: 'False'; Quiet: 'False'; Reinstall: 'False'; TrustRepository: 'False'; NoClobber: 'False'; AsNupkg: 'False'; IncludeXml 'True'; SavePackage 'False'; TemporaryPath ''; SkipDependencyCheck: 'False'; AuthenticodeCheck: 'False'; PathsToInstallPkg: 'C:\Users\Teatowel\Documents\PowerShell\Modules,C:\Users\Teatowel\Documents\PowerShell\Scripts'; Scope 'CurrentUser'
DEBUG: In InstallHelper::ProcessRepositories()
VERBOSE: credential successfully read from vault and set for repository: MyCompanyPowerShellModules
VERBOSE: Attempting to search for packages in 'MyCompanyPowerShellModules'
WARNING: Installing dependencies is not currently supported for V3 server protocol repositories. The package will be installed without installing dependencies.

Confirm
Continue with this operation?
[Y] Yes  [A] Yes to All  [H] Halt Command  [S] Suspend  [?] Help (default is "Y"): a
DEBUG: In InstallHelper::InstallPackages()
DEBUG: In InstallHelper::InstallPackage()
DEBUG: In V3ServerAPICalls::FindName()
DEBUG: In V3ServerAPICalls::FindNameHelper()
DEBUG: In V3ServerAPICalls::GetVersionedPackageEntriesFromRegistrationsResource()
DEBUG: In V3ServerAPICalls::GetResourcesFromServiceIndex()
DEBUG: In V3ServerAPICalls::HttpRequestCall()
DEBUG: Request url is 'https://pkgs.dev.azure.com/MyCompany/_packaging/MyCompanyPowerShell/nuget/v3/index.json'
DEBUG: In V3ServerAPICalls::FindRegistrationsBaseUrl()
DEBUG: In V3ServerAPICalls::GetVersionedResponsesFromRegistrationsResource()
DEBUG: In V3ServerAPICalls::HttpRequestCall()
DEBUG: Request url is 'https://pkgs.dev.azure.com/MyCompany/_packaging/918a5b71-bf65-418b-a793-67216bc9437b/nuget/v3/registrations2-semver2/pswindowsupdate/index.json'
DEBUG: In V3ServerAPICalls::GetMetadataElementsFromResponse()
DEBUG: In V3ServerAPICalls::GetMetadataElementFromItemsElement()
DEBUG: In V3ServerAPICalls::IsLatestVersionFirstForSearch()
DEBUG: 'PSWindowsUpdate' version parsed as '2.2.1.4'

Confirm
Are you sure you want to perform this action?
Performing the operation "Install-PSResource" on target "Package to install: 'PSWindowsUpdate', version: '2.2.1.4'".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): a
DEBUG: In V3ServerAPICalls::InstallPackage()
DEBUG: In V3ServerAPICalls::InstallVersion()
DEBUG: In V3ServerAPICalls::InstallHelper()
DEBUG: In V3ServerAPICalls::GetVersionedPackageEntriesFromRegistrationsResource()
DEBUG: In V3ServerAPICalls::GetResourcesFromServiceIndex()
DEBUG: In V3ServerAPICalls::HttpRequestCall()
DEBUG: Request url is 'https://pkgs.dev.azure.com/MyCompany/_packaging/MyCompanyPowerShell/nuget/v3/index.json'
DEBUG: In V3ServerAPICalls::FindRegistrationsBaseUrl()
DEBUG: In V3ServerAPICalls::GetVersionedResponsesFromRegistrationsResource()
DEBUG: In V3ServerAPICalls::HttpRequestCall()
DEBUG: Request url is 'https://pkgs.dev.azure.com/MyCompany/_packaging/918a5b71-bf65-418b-a793-67216bc9437b/nuget/v3/registrations2-semver2/pswindowsupdate/index.json'
DEBUG: In V3ServerAPICalls::GetMetadataElementsFromResponse()
DEBUG: In V3ServerAPICalls::GetMetadataElementFromItemsElement()
DEBUG: In V3ServerAPICalls::IsLatestVersionFirstForInstall()
DEBUG: In V3ServerAPICalls::HttpRequestCallForContent()
DEBUG: Request url is 'https://pkgs.dev.azure.com/MyCompany/_packaging/918a5b71-bf65-418b-a793-67216bc9437b/nuget/v3/flat2/pswindowsupdate/2.2.1.4/pswindowsupdate.2.2.1.4.nupkg'
DEBUG: In InstallHelper::TryInstallToTempPath()
DEBUG: In InstallHelper::CallAcceptLicense()
DEBUG: In InstallHelper::DeleteExtraneousFiles()
DEBUG: Deleting 'C:\Users\Teatowel\AppData\Local\Temp\cda0c32b-ebe7-4608-820b-338d27ae2e4f\pswindowsupdate\2.2.1.4\PSWindowsUpdate.nuspec'
DEBUG: Deleting 'C:\Users\Teatowel\AppData\Local\Temp\cda0c32b-ebe7-4608-820b-338d27ae2e4f\pswindowsupdate\2.2.1.4\[Content_Types].xml'
DEBUG: Deleting 'C:\Users\Teatowel\AppData\Local\Temp\cda0c32b-ebe7-4608-820b-338d27ae2e4f\pswindowsupdate\2.2.1.4\_rels'
DEBUG: Deleting 'C:\Users\Teatowel\AppData\Local\Temp\cda0c32b-ebe7-4608-820b-338d27ae2e4f\pswindowsupdate\2.2.1.4\package'
DEBUG: In InstallHelper::CreateMetadataXMLFile()
WARNING: Installing dependencies is not currently supported for V3 server protocol repositories. The package will be installed without installing dependencies.
DEBUG: In InstallHelper::TryMoveInstallContent()
DEBUG: In InstallHelper::MoveFilesIntoInstallPath()
VERBOSE: Installation source path is: 'C:\Users\Teatowel\AppData\Local\Temp\cda0c32b-ebe7-4608-820b-338d27ae2e4f\pswindowsupdate\2.2.1.4'
VERBOSE: Installation destination path is: 'C:\Users\Teatowel\Documents\PowerShell\Modules\PSWindowsUpdate\2.2.1.4'
VERBOSE: Attempting to move 'C:\Users\Teatowel\AppData\Local\Temp\cda0c32b-ebe7-4608-820b-338d27ae2e4f\pswindowsupdate\2.2.1.4' to 'C:\Users\Teatowel\Documents\PowerShell\Modules\PSWindowsUpdate\2.2.1.4'
VERBOSE: Successfully installed package 'PSWindowsUpdate' to location 'C:\Users\Teatowel\Documents\PowerShell\Modules'
VERBOSE: Attempting to delete 'C:\Users\Teatowel\AppData\Local\Temp\cda0c32b-ebe7-4608-820b-338d27ae2e4f'
VERBOSE: Successfully deleted 'C:\Users\Teatowel\AppData\Local\Temp\cda0c32b-ebe7-4608-820b-338d27ae2e4f'

@nbarnwell
Copy link
Author

@anamnavi I guess you may as well close this as "won't fix". I doubt you'll ever get around to an actual fix, as it's been YEARS now that this thing hasn't worked properly. I'm giving up and switching to a home-grown git-based module installation system instead. I'm assuming your team isn't using authenticated AzDO artifacts feeds themselves otherwise the sheer frustration would've seen this fixed ages ago. Best wishes on the project, but I'm moving on from PSResourceGet. Maybe I'll try again in a few years.

@ephos
Copy link

ephos commented May 15, 2024

I have the same issue as @nbarnwell currently with Sonatype Nexus.

Find-PSResource works but Install-PSResource fails. I know this issue was initially for Azure DevOps Artifacts and I am happy to open a new issue if needed but wanted to +1 to this before doing so. 1`

Try to install my module, and this is the error I get:

Install-PSResource: 'Response status code does not indicate success: 404 (Not Found).' Request sent: 'https://mynexusserver/nexus/repository/feed/package/MyPowerShellModule/1.2.3'

PowerShell Version 7.4.2
Microsoft.PowerShell.PSResourceGet 1.0.5

@SydneyhSmith Do you want me to open another issue? Also is there any way to start prioritizing fixes for 3rd party repositories? It's my understanding there is no more updates for PowerShellGet (v2). Yet many of us using internal repositories (ProGet, Nexus, Azure DevOps Artifacts) have issues that prevent us from using PSResourceGet (v3). Currently in my situation PowerShellGet v2 is broken as well on a credential enabled feed, so I have no way to do any kind of PowerShell module management in the environment. I know there are no more updates coming for v2, so I am not going to bother opening an issue for that.

Please advise, many of us are stuck and issues for these 3rd party repositories are going unfixed.

@ephos
Copy link

ephos commented May 21, 2024

A follow up to my previous comment for anyone who runs into this I found one way to get it to work (for Sonatype Nexus).

In my case I found that the NuGet repository in Nexus acts as both a v2 and v3 feed. With PSResourceGet I was able to register the PSRepository and install modules. V3 is a little rough currently since it cannot find by wildcards or handle dependencies (I think is is more of a NuGet issue than a PowerShell/PSResourceGet one). It's an adequate workaround since I at least have a working PSRepository.

$parameters = @{
    Name           = 'nexus-hosted-ps'
    Uri            = 'https://nexusserver:8080/nexus/repository/nexus-hosted-ps/index.json'
    ApiVersion     = 'v3'
    Trusted        = $true
    Priority       = 45
    CredentialInfo = [Microsoft.PowerShell.PSResourceGet.UtilClasses.PSCredentialInfo]::new('myVault', 'Nexus_User_Token')
}

# Register the repository
Register-PSResourceRepository @parameters

# Find a module
Find-PSResource -Name My.PSModule -Repository nexus-hosted-ps -Credential (Get-Secret -Name Nexus_User_Token)

I know it's tough to handle all the nuances of every 3rd party repository when creating something like PSResourceGet but I still feel like it needs to be prioritized. I would have to imagine Microsoft has the ability to spin up the 5-6 major ones to do some kind of integration testing with PSResourceGet. I really hope the PowerShell Team prioritize PowerShell's package management because with a little polish it'll finally be in a solid state, we're so close!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants