Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

    If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

    "Unable to resolve package source" when registering PowerShell repository

    Scheduled Pinned Locked Moved Support
    progetpowershell
    4 Posts 3 Posters 29 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • curtis.denotter_1361C Offline
      curtis.denotter_1361
      last edited by curtis.denotter_1361

      Using a ProGet installation with built-in user security enabled, I am trying to register my PowerShell feed as a repository and install a module from it. I am using a Personal API token to handle authentication. I am trying to run the following in PowerShell:

      $progeturl = "my-proget-url.example.com"
      $repository = "third-party-powershell"
      $apikey = Read-Host -MaskInput # Prompts for API Token
      
      $password = ConvertTo-SecureString $apikey -AsPlainText -Force
      $credential = New-Object System.Management.Automation.PSCredential("api", $password)
      Register-PSRepository -Name $repository -SourceLocation "https://${progeturl}/nuget/${repository}/" -Credential $credential
      

      This results in the following response:

      WARNING: Unable to resolve package source 'https://my-proget-url.example.com/nuget/third-party-powershell/'

      The Get-PSRepository command shows my new "third-party-powershell" module in the list, but when I try to install a module, I get the following output:

      PS C:\> Install-Module -Name "PsIni" -RequiredVersion "3.1.2" -Repository "third-party-powershell"
      WARNING: Unable to resolve package source 'https://my-proget-url.example.com/nuget/third-party-powershell/'.
      Install-Package: No match was found for the specified search criteria and module name 'PsIni'. Try Get-PSRepository to see all available registered module repositories.
      

      If I attempt to register the repository without passing the credential, I get the error: Register-PSRepository: The specified Uri 'https://my-proget-url.example.com/nuget/third-party-powershell/' for parameter 'SourceLocation' is an invalid Web Uri. Please ensure that it meets the Web Uri requirements.

      Using the -Credential flag in the Install-Module call does not make a difference in the returned output. I have no configured proxy that could be impacting the register or install calls.

      I'm a little stumped! How can I use PowerShell feeds configured in my ProGet installation?

      1 Reply Last reply Reply Quote 0
      • atrippA Offline
        atripp inedo-engineer
        last edited by

        Hi @curtis-denotter_1361 ,

        It looks like you're following the right steps; here is our HOW-TO guide on the topic:
        https://docs.inedo.com/docs/proget-powershell-private-module-repository

        If I had to guess, the issue is with HTTPS/TLS resolution. That's what most search results for "Unable to resolve package source" came up with, anyway. You'd have to use a tool like Wireshark to be sure, since the error message from PowerShell isn't very helpful.

        You can force PowerShell to use TLS12:
        [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

        It might also be certificate related. You may get a better error message if you do like a Invoke-WebRequest to your ProGet URL.

        Cheers,
        Alana

        1 Reply Last reply Reply Quote 0
        • curtis.denotter_1361C Offline
          curtis.denotter_1361
          last edited by

          Hello and thanks for the suggestions, @atripp!

          I tried doing an Invoke-WebRequest against the repository URL. It appears to work fine, which is nice but also a pain as it indicates the problem is more complicated.

          PS C:\> [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
          PS C:\> $test = Invoke-WebRequest -UseBasicParsing "https://${progeturl}/nuget/${repository}/"
          Invoke-WebRequest: You must log in to issue this request because the anonymous user does not have the Feeds_ViewFeed privilege.
          PS C:\>
          PS C:\> $test = Invoke-WebRequest -UseBasicParsing "https://${progeturl}/nuget/${repository}/" -Credential $credential
          PS C:\> $test
          
          StatusCode        : 200
          StatusDescription : OK
          Content           : <?xml version="1.0" encoding="utf-8"?><service xmlns="http://www.w3.org/2007/app"><workspace><title xmlns="http://www.w3.org/2005/Atom">Default</title><collection
                              href="Packages"><title xmlns="http://…">
          RawContent        : HTTP/1.1 200 OK
                              Cache-Control: no-store, must-revalidate, no-cache, max-age=0
                              Pragma: no-cache
                              Server: Microsoft-IIS/10.0
                              X-ProGet-Version: 22.0.7.3
                              X-Powered-By: ASP.NET
                              Date: Sat, 24 Sep 2022 …
          Headers           : {[Cache-Control, System.String[]], [Pragma, System.String[]], [Server, System.String[]], [X-ProGet-Version, System.String[]]…}
          Images            : {}
          InputFields       : {}
          Links             : {}
          RawContentLength  : 273
          RelationLink      : {}
          
          
          PS C:\> echo $test.Content
          <?xml version="1.0" encoding="utf-8"?><service xmlns="http://www.w3.org/2007/app"><workspace><title xmlns="http://www.w3.org/2005/Atom">Default</title><collection href="Packages"><title xmlns="http://www.w3.org/2005/Atom">Packages</title></collection></workspace></service>
          

          I will attempt to use a tool like Wireshark or Fiddler to see what's going on.

          V 1 Reply Last reply Reply Quote 0
          • V Offline
            vitaut_nestohr_4326 @curtis.denotter_1361
            last edited by

            @curtis-denotter_1361 Were you able to resolve this? If so, what was the root cause?

            1 Reply Last reply Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • 1 / 1
            • First post
              Last post
            Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation