dotnet tool restore interactive doesn't prompt for DeviceFlow since .NET 6 SDK
See original GitHub issueDescribe the bug
If I use .NET 5 SDK, and call dotnet tool restore --interactive
, I get presented with the DeviceFlow authentication flow from NuGet’s MicrosoftCredentialProvider plugin (https://github.com/microsoft/artifacts-credprovider).
I get something like this:
[CredentialProvider]DeviceFlow: https://XXX.pkgs.visualstudio.com/_packaging/XXX/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 XXXXXXXX to authenticate.
**********************************************************************
However, if I need the same thing in .NET 6 SDK (using 6.0.100), the output is silent, I don’t receive any prompt on the output.
I found a workaround to add --verbosity minimal
in the command parameters. But without this, it seems that the default verbosity is quiet
which doesn’t include the interactive auth flow prompt.
In .NET 5, the verbosity switch didn’t have any effect for dotnet tool restore
, I even created issue #16535. but in .NET 6, suddenly, the verbosity is working. It’s just that the default verbosity is too quiet and is missing the important prompts.
To Reproduce
- ensure that the tool packages to be restored aren’t in NuGet cache
- ensure that you use feed that needs MicrosoftCredentialProvider auth (https://github.com/microsoft/artifacts-credprovider), I’m using Azure DevOps Artifacts
- ensure you don’t have any MicrosoftCredentialProvider token already in cache
- call
dotnet tool restore --interactive
- expected: prompt for device login
- actual: no output, program keeps running and waiting for the auth
Further technical details
.NET SDK (reflecting any global.json):
Version: 6.0.100
Commit: 9e8b04bbff
Issue Analytics
- State:
- Created 2 years ago
- Reactions:41
- Comments:18 (1 by maintainers)
Actually, our workaround was similar, even
--verbosity minimal
worked.It’s as if the default verbosity is
quiet
, which is too quiet.I’ve had the same issue. As a workaround use the -v diag parameter, at least this worked for me