1

I am trying to add a NuGet package from a private source; https://[provider].pkgs.visualstudio.com/[package]/nuget/v3/index.json (provider and package is left out intentionally).

I have added the sources to a local Nuget.Config file in my project

<configuration>
    <packageSources>
        <add key="[name]" value="https://[provider].pkgs.visualstudio.com/_packaging/[package]/nuget/v3/index.json" />
    </packageSources>
    <packageSourceCredentials>
        <[name]>
            <add key="Username" value="[username]" />
            <add key="Password" value="[password]" />
        </[name]>
    </packageSourceCredentials>
</configuration>

and when i request a list of sources through CLI I get the following

Registered Sources:

  1.  [name] [Enabled]
   https://[provider].pkgs.visualstudio.com/_packaging/[package]/nuget/v3/index.json
  2.  nuget.org [Enabled]
      https://api.nuget.org/v3/index.json

However when I try to add the specific package to my project I get the following error

error: Unable to load the service index for source https://[provider].pkgs.visualstudio.com/_packaging/[package]/nuget/v3/index.json.
error: Response status code does not indicate success: 401 (Unauthorized).

The natural explanation would of course be that I entered invalid credentials. However, when I access the source in a browser I am able to login with the same credentials and inspect the index.json file.

I am wondering if I could be missing something in the process of adding a private NuGet source?

(NuGet Version: 4.9.3.5777)

user3170354
  • 391
  • 1
  • 4
  • 11

1 Answers1

0

I just found out what I was missing. I needed to install Azure Artifacts Credential Provider and follow the instructions on the GitHub page.

user3170354
  • 391
  • 1
  • 4
  • 11