artifacts-credprovider: The "dotnet restore --interactive" doesn't work anymore for Azure DevOps private feeds

Couple months ago, we were using dotnet restore --interactive command restore the packages to local folder in powershell script from the Azure DevOps private feeds. Now it does not work anymore.

After successfully logged-in using DeviceFlow in Microsoft Edge, the restore still failed with status code 401.

Determining projects to restore...
      [CredentialProvider]DeviceFlow: https://pkgs.dev.azure.com/xxx/_packaging/yyy/nuget/v3/index.json
      [CredentialProvider]ATTENTION: User interaction required.

      **********************************************************************

      To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code XXXXXXXXX to authenticate.
      **********************************************************************

C:\Program Files\dotnet\sdk\3.1.401\NuGet.targets(128,5): error : Unable to load the service index for source https://pkgs.dev.azure.com/xxx/_packaging/yyy/nuget/v3/index.json. [C:\Users\mycode.sln]
C:\Program Files\dotnet\sdk\3.1.401\NuGet.targets(128,5): error :   Response status code does not indicate success: 401 (Unauthorized). [C:\Users\mycode.sln]

First we thought it might be because we have upgraded to dotnet 5.0. We did it again in a machine only use dotnet 3.1, and get the same result.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 4
  • Comments: 16 (2 by maintainers)

Most upvoted comments

In order to consolidate to fewer feedback channels, we’ve moved suggestions and issue reporting to Developer Community.

Sorry, I’m not on the team. Just someone who hit a similar issue and this happened to be a workaround.

cc: @johnterickson who might have better points of contact.

@johnterickson When running dotnet add package MYPACKAGE --interactive I get the following error:

error: Unable to load the service index for source https://pkgs.dev.azure.com/****/****/_packaging/****/nuget/v3/index.json.
error:   Response status code does not indicate success: 401 (Unauthorized).

Currently I have set the environment variable NUGET_CREDENTIALPROVIDER_MSAL_ENABLED to true dotnet version: 5.0.103

It almost seems like when I run the command it’s not actually executing the artifacts-credential-provider