microsoft / vscode-dotnettools

This is a feedback repository to capture issues logged for the C# Dev Kit and related extensions from Visual Studio Code
Other
192 stars 6 forks source link

VScode Mac - package restore from local azure nuget artifact feed fails with 401 unauthorized error #1074

Closed viswanath-pamarthi closed 1 day ago

viswanath-pamarthi commented 3 weeks ago

Describe the Issue

In Visual Studio Code Mac, we have noticed that Local azure nuget artifact feed fails package restore with 401 unauthorized error. However, works perfectly fine in Visual Studio Mac. Below is the error: /usr/local/share/dotnet/sdk/8.0.201/NuGet.targets(169,5): error : Unable to load the service index for source https://pkgs.dev.azure.com/**MyOrg**/_packaging/**MyFeed**/nuget/v3/index.json.

Steps To Reproduce

  1. Create any MAUI/net8-ios/net8-android projects using vscode mac
  2. Add a nuget.config file configured with a local azure nuget artifact feed to your project directory, and add a package from local azure nuget feed to the project
  3. Set the build target in vscode and hit F5 to deploy/build the project
  4. Notice that the build fails while trying to restore NuGet package with 401 unauthorized error as mentioned in bug description.

Expected Behavior

As I am already authenticated to C# dev kit extension with Visual studio subscription via Microsoft login credentials of our organization, nuget restore in VS code Mac should complete/authenticate successfully without an error.

Environment Information

jebriede commented 2 weeks ago

@viswanath-pamarthi Thanks for reaching out. Based on the repro steps you provided, it looks like you may need to install the Azure Artifacts Credential Provider plugin. This link with give details on how to install it on Mac: https://github.com/microsoft/artifacts-credprovider?tab=readme-ov-file#installation-on-linux-and-mac

After you've installed that, please try the repro again and if you are now seeing a popup requesting you to authenticate to your private feed, please see the instructions to authenticate in the Output pane.

viswanath-pamarthi commented 6 days ago

@jebriede Thank you for your response, this is actually for local development on Mac, time being I have resolved the issue by using a PAT token and clearTestPassword in the nuget file for the private azure nuget feed.

Sure, will install the "Azure Artifacts Credential Provider plugin" and try.

github-actions[bot] commented 6 days ago

@jebriede, the 'needs-more-info' label has been removed upon receiving further response from the original bug filer.

nkolev92 commented 6 days ago

@viswanath-pamarthi Here's a doc we have on managing credentials: https://learn.microsoft.com/en-us/nuget/consume-packages/consuming-packages-authenticated-feeds#security-best-practices-for-managing-credentials.

Given that your issue is resolved, I'm thinking we should close this.

Do you agree?

viswanath-pamarthi commented 1 day ago

Sorry for the delay, yes, we can close this.

github-actions[bot] commented 1 day ago

@jebriede, the 'needs-more-info' label has been removed upon receiving further response from the original bug filer.