Getting 401 When Restoring NuGet: Azure DevOps Private NuGet Artifacts

Randula Koralage
1 min readOct 31, 2019

This is about a common error that occurs in Visual Studio when you are trying to load a project that includes private NuGet packages in Azure DevOps. 🙂

error :   Response status code does not indicate success: 401 (Unauthorized).

The reason for this error is,

You have no permissions to access your Azure DevOps private feed through your PC. 😕

Your package source may not have been added to NuGet.exe in

C:\Users\<YOURACCOUNT>\AppData\Roaming\NuGet

Or you may haven’t saved authentication credentials for the feed.

Simply follow the given steps to solve this problem 😉

i. Download nuget.exe and add the folder that contains .exe file to yourPATH environment variable.

ii. Generate a PAT for your private feed with read-write access for packaging. (Guide)

iii. Remove feed from the visual studio if it already exists.

iv. Execute the following command in the command prompt

nuget.exe sources Add -Name “{FEEDNAME}” -Source “https://pkgs.dev.azure.com/in3/_packaging/{FEEDNAME}/nuget/v3/index.json" -username {EMAIL} -password {PAT token}

v. Restart Visual Studio

vi. Restore NuGet packages

--

--