Visual Studio needs credentials to access pkgs.dev.azure.com on mac

Viewed 3071

I am working on existing Xamarin project on mac which is on AzureDevOps. When I open that project in Visual studio for mac it prompting popup this

Image

However I logged in Visual Studio by credentials but when try with same credentials here its continuously pops out after hit OK button . and last it say restore package failed. Also I tried with Windows but its allow to restore all the packages without any hurdles after logged-in in VS2019. Any Suggestions....

4 Answers

For me, it only worked, with the following credentials:

Username: username@domain

(e.g. if your email is: "peter.parker@spiderman.com" -> use "peter.parker@spiderman")

Password: PAT-Key

The Personal Access Token (PAT) itself only needed Read-Rights for Packaging.

I was having the same issue while using Visual Studio for Mac, i.e., "Visual Studio need credentials to access pkgs.de.azure.com" and it keep asking for username and password. Although I used the same credentials when I cloned the repository from Azure DevOps.

What I understand that my Personal Access Token (PAT) has Code (Read & Write) scope of access but not the Packaging (Read) access that is why, it was unable to restore packages.

I went to Personal Access Token settings, and added Packaging (Read) access to scope of access and then it worked perfectly. I hope it might be helpful for you :)

setting Packaging (Read) access for PAT in Azure DevOps

Your Xamarin project probably has some Nuget Packages configured that com from an DevOps Artifact Pipeline. Visual Studio 4Mac is not able to connect to this feed by default. (Note: Rider and Visual Studio for Windows would show a different Login prompt, that would work!)

The solution is to change the nuget source configuration. This may help you configuring your nuget feed to connect via Personal Access Token: https://docs.microsoft.com/en-us/azure/devops/artifacts/nuget/nuget-exe?view=azure-devops

cheers, Chris

If you have your PAT(Personal Access Token), enter it in the Username field and leave the Password field empty. If you don't I suggest you create a new one and set it to "Full Access" and repeat the step above.

Below are the steps to create a PAT

  1. From your home page, open your user settings, and then select Profile. enter image description here

  2. Under Security, select Personal access tokens. Select the token for which you want to modify, and then select Edit.Select Edit to modify PAT

  3. Edit the token name, organization it applies to, token expiration, or the scope of access that's associated with the token, and then select Save.Modify and Save PAT

Make sure you copy the PAT once you see it, because you won't see it again.

Related