dotnet restore --interactive: 401 Unauthorized on Windows with Azure DevOps feed
See original GitHub issueSteps to reproduce
dotnet restore always fails on Windows when connecting to a private feed hosted on ADO.
>dotnet restore --interactive
Restoring packages for ....csproj...
Restoring packages for ...csproj...
C:\Program Files\dotnet\sdk\2.2.104\NuGet.targets(114,5): error : Unable to load the service index for source https://pkgs.dev.azure.com/microsoft/_packaging/something/nuget/v3/index.json. [....sln]
C:\Program Files\dotnet\sdk\2.2.104\NuGet.targets(114,5): error : Response status code does not indicate success: 401 (Unauthorized). [....sln]
Expected behavior
Running dotnet restore --interactive
should prompt for code auth, like it does on macOS. Alternatively, running dotnet restore
should behave like nuget restore
does, and prompt for credentials allowing you to enter a PAT.
Actual behavior
On Windows 10, running dotnet restore --interactive
or dotnet restore
will always fail when connecting to a private feed on ADO.
Environment data
dotnet --info
output:
.NET Core SDK (reflecting any global.json): Version: 2.2.104 Commit: 73f036d4ac
Runtime Environment: OS Name: Windows OS Version: 10.0.17763 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\2.2.104\
Host (useful for support): Version: 2.2.2 Commit: a4fd7b2c84
.NET Core SDKs installed: 2.1.4 [C:\Program Files\dotnet\sdk] 2.1.202 [C:\Program Files\dotnet\sdk] 2.1.402 [C:\Program Files\dotnet\sdk] 2.1.500 [C:\Program Files\dotnet\sdk] 2.1.502 [C:\Program Files\dotnet\sdk] 2.1.503 [C:\Program Files\dotnet\sdk] 2.2.102 [C:\Program Files\dotnet\sdk] 2.2.104 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:16 (4 by maintainers)
Turns out I had the cred provider plugin already installed on macOS, which is why --interactive was working.
For anyone interested reading this, Nikolche let me know that Microsoft decided not to put the plugin in dotnet.exe because there were concerns that shipping auth integration to Azure DevOps within the sdk would’ve been unfair to other feed providers. To resolve your 401 issues you need to install the auth plugin manually that Nikolche mentioned:
Grab the plugin from https://github.com/Microsoft/artifacts-credprovider/releases Install into ~/.nuget/plugins/netcore
Full instructions: https://github.com/Microsoft/artifacts-credprovider
I wish this was more clear in some way; maybe dotnet could give a warning that --interactive will not work without some credential manager instead of doing nothing?