Visual Studio Encounters 403 Error Connecting to DevOps Project - visual-studio

One of my developers is receiving the following message from Visual Studio 2017 Enterprise when trying to connect to one of our DevOps projects and we've tried everything we can think of and everything we've found from searching Stack Overflow and the internet in general just hasn't worked.
Here's the error from Visual Studio:
We could not add the account
The browser based authentication dialog failed to complete. Reason:
The server understood the request, but is refusing to fulfill it.
What we've tried
Deleting the folders Team Foundation, VisualStudio, VisualStudio Services, VSCommon, and vshub located in %userprofile%\AppData\Local\Microsoft
Deleting everything from Windows Credential Manager.
Authenticating via browser (success).
Repository is hosted on dev.azure.com.
From what I understand, this is an HTTP 403 error which means the user successfully authenticated and that they just don't have permissions to view the requested resource. Permissions in DevOps are identical to other users that don't have any issues. We have 1 group for the developers and if you're in that group, you have all necessary permissions so I'm confident their permissions are identical to the other devs that aren't having any issues.
I think I understand what this error means for websites in general, however I seem to be at a loss for what either Visual Studio or Azure DevOps wants us to do specifically to alleviate this error.

The browser based authentication dialog failed to complete.
Once it was a known issue in old VS2015 and VS2017, but I can't reproduce it on my latest VS2017 15.9.23. Here're some tips you can follow to resolve that issue:
1.Update VS2017 to latest 15.9.23 version.
2.Navigate to VS installation path C:\Program Files (x86)\Microsoft Visual Studio\2017\VsEdition\Common7\IDE and run devenv.exe /resetsettings and devenv.exe /resetuserdata to reset the VS settings and userdata. From Joyce Lin.
3.Check your registry settings and empty the China endpoint if it exists. Check this one. Now try to log in the VS...
4.If the issue persists after #3, you can:
Open Visual Studio
Click Help > Send Feedback > Report a problem
An instance of Visual Studio Feedback will open
Attempt to sign in using your MS account
If sign in is successful, check if you are signed into Visual Studio
Hint from Nathan Timblin.
Hope all above helps :)

Related

Where do I find Visual Studio Team explorer error details?

When I open the Pending Changes tab in Visual Studio Team Explorer, it says that "One or more errors occurred." Where can I find details on what kind(s) of error have occurred?
Some background: We have recently upgraded our source code repository from TFS 2010 to Azure DevOps Server 2020 (with TFS 2015 as a required intermediate step), in the process moving from one server to another. After switching the URL in Visual Studio, developers started getting this error message. Apart from that, everything seems to be working fine. Pending changes are displayed, check-in/check-out works.
There is no such related logs stored in TFS/Azure DevOps side.
For TFS/Azure DevOps, the installation log file generally store in temp folder.
Typically this folder is : C:\Users\{name}\AppData\Local\Temp
And the Configuration logs stored in:
C:\ProgramData\Microsoft\Team Foundation\Server Configuration\Logs
The logs should be stored accordingly in case of TFS version upgrade.
In your situation, sometimes if you are working with multiple TFS account /TFS version in the same system then TFS caches something and throws the error . So, for this you can clear the TFS cache and check if this work.
You can clear TFS’s cache from following location:
C:\Users\UserName\AppData\Local\Microsoft\Team Foundation\x.0\Cache
Once cache will delete, probably TFS will ask for credential to reconnect. You need to provide valid credentials.
If you still get similar errors after above steps, I would suggest you also clear Visual Studio cache, which may do the trick.
I closed the visual studio and reopened and it got fixed.

TF30063:You are not authorized to access dev.azure.com but I can connect

I am using Azure Devops and VS2017 15.9.7.
I am logged into Devops and can sync.
When I open my project I get a message
"TF30063": You are not authorized to access dev.azure.com/myproject
I have tried going into credentials manager and deleting all the credentials for the devops organisation.
I have looked at this question and tried logging out via the browser within VS
TF30063:You are not authorized to access dev.azure.com but I can connect
I have encountered the same issue. (I need to switch back and forth between work account and test account). Of course, there could be so many reasons and it could be different for each (cached another account, or modified the password).
To resolve this issue I have two methods/steps.
Step 1 is to clear the credential from credential manager:
Go to Control Panel (with small icon view)-->User Accounts-->Manage your credentials (on the left column)-->Select Windows Credentials-->Scroll down to the Generic Credentials section and look for your TFS server connection.
Step 2 is to click on the operation that Connects to the Team Projects which is the button/plug icon in the Team Explorer tab. Then to also right click the project you are getting this issue on and select Connect:
I also have tried other methods but not work for me, if possible, you can check if it is useful to you:
How To Fix TF30063 Error
Error TF30063: You are not authorized to access
The comment by Kirsten Greed in the accepted solution resolved the issue for me. Reproduced here:
The problem was that I was opening the project using the Recent Project section of the start page. I closed VS, re-opened and then opened the project via "connect: in Team Explorer. Then exited. Now it seems to open ok either way.
I had the same issue, It solved by simply rerunning the Visual Studio as Administrator.
Running this command in cmd prompt, forces the re-authentication screen to come up and worked for me:
tf.exe get . /r
NOTE: you may need to locate tf.exe on your disk. For instance I have it at this location: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\TF.exe
Another reason for this error is that you might have to re-enter your credentials in Visual Studio:
Restarting Visual Studio and connecting to Azure DevOps did the trick for me.
If the is problem like below:
The solution will be like below:
And after that select:
Re-enter your credentials
Step 1: Add
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer" in the environment variable path
Step 2: remove azuredevops org related credential from credential manager
Step 3: Delete this folder:
C:\Users<UserName>\AppData\Local\Microsoft\Team Foundation\7.0\Cache
Step 3:
run tf workspaces /collection:https://dev.azure.com/royalmailgroup in cmd
It might be the case of a password change.
In my case I had update my account password in a different machine. So on machine #02 I went to Visual Studio > Account Settings. After the pop-up opened, there was a message to re-enter credentials.
Sometimes the password isn't updated across all used app/services and you have to enter that manually.
Hope that helps.
None of the other methods above worked for me. I tried this in visual studio 2022 and it worked.
Open the Developer PowerShell (search for PowerShell) and type in the following:
TF vc permission
This will bring up a login screen and allow you to log in.
After that you should have permission.
In Visual Studio>Navigate to Tools > Nuget Package Manager >Package Manage Settings>Azure Service Authentication>Verify/Change the account
Leo Liu's answer got me on the right track. My problem could have originated from having two different Azure DevOps accounts cached in Windows Credentials and Visual Studio started choosing which one to authenticate with at random.
Log out of both accounts in Windows Credentials.
(The Manage Connections window does not have access to source control now.)
Open up the Azure DevOps website and logout there.
Login on Azure DevOps website.
(Visual Studio's Manage Connections can access source control again.)
What did it for me was open VS without code and connect via Team Explorer, but then also it threw the same error and after some time I logged out of azure web and tried connecting via Team Explorer again and it worked.

TFS Error - Unexpected End of File

When I open Visual Studio and attempt to connect to TFS, I get the following error message:
Error
Unexpected end of file.
I've found a handful of places online (like here and here) where people have run into similar situations but clearing the Team Foundation cache as recommended doesn't solve the issue.
I even completely uninstalled Visual Studio Enterprise 2015 and installed Visual Studio Enterprise 2017 and still get the same error.
I recently created a new TFS instance on another server for testing out some automated build features without messing with our current setup and can connect to the new TFS instance just fine.
What would cause this error?
First you could use another machine with VS installed to connect the same TFS under your account. This will narrow down if the issue only occurs on your local machine or not.
You could try to clear both TFS and VS cache issue.(You may not uninstalled the previous VS clearly).
For TFS cache:
close all instances of Visual Studio on the client machine,
manually delete the corresponding Tfs client cache folder, and then
start Visual Studio
The corresponding Tfs folders to manually delete are as follows:
Tfs 2017: "%localappdata%\Microsoft\Team Foundation\7.0\Cache\"
Tfs 2015: "%localappdata%\Microsoft\Team Foundation\6.0\Cache\"
For VS cache:
Delete the contents from the following folders
C:\Users\<<Your Alias>>\AppData\Local\Microsoft\VisualStudio
C:\Users\<<Your Alias>>\AppData\Local\Microsoft\VSCommon
Moreover, also give a try with removing the tfs related credentials from Credential Manager, close all Visual Studio instances, deleting %LOCALAPPDATA%\.IdentityService, use another user account connect to the TFS server.
Update: Op ended up doing an OS reload and haven't had any issues since.
I ended up doing a full OS reload
It was likely overkill as I'm convinced there was a cached file somewhere I couldn't locate that was holding those settings but I didn't have the extra time to fiddle with it and I needed to move to Windows 10 at some point anyway.
I'd venture to guess #PatrickLu-MSFT's answer will work for most people but for whatever reason it didn't for me.
In my case I closed Visual Studio 2017, went to the solution's directory and deleted the .vssscc file.
The file was then regenerated and the problem was solved.

TF30063 error from Visual Studio Team Explorer but connected from the web

We are trying to setup TFS for our project installed in a Windows Server. All the collection(s) and projects are already created in TFS but while connecting through Visual Studio 2015 Team Explorer we are getting the below error in mapping section:
TF30063: You are not authorized to access xx.xxx.xxx.xx\ABCDEFGH.
While the same user is able to connect the TFS Collection from IE/Chrome.
Have you ever login the VS Team Explorer with other accounts? Can you connect to the TFS on another client machine?
Anyway, please try below ways to narrow down the issue:
Log out of Visual Studio Online from all browsers and VS.
Remove the existing credential from credential manager(Control panel > Credential manager, which contained the previous password)
Clear cache from C:\Users\ [your username]
\AppData\Local\Microsoft\Team Foundation{version}\Cache password.)
Run "devenv /resetuserdata" to clear your logon for Visual Studio.
Let it finish, it may take a while.
Launch Visual Studio, connect to the TFS project again with your
account.
You can also reference this similar thread: Error TF30063: You are not authorized to access ... \DefaultCollection

TF31002: Unable to connect to Team Foundation Server 2013

on my computer I have a problem with connection to TFS 2013 using Visual Studio 2013 and 2015. This problem occurs on only one machine. Other users in the net can work without problems. In the same time I can connect to projects on Visual Studio Online. Problem happened after switching a few times between projects. Nothing was installed or changed either on my computer or on TFS Server. I've got following error: "Technical information (for administrator): The server committed a protocol violation. Section=ResponseHeader Detail=CR must be followed by LF".
I've check this article:
https://msdn.microsoft.com/query/dev12.query?appId=Dev12IDEF1&l=EN-US&k=k(vs.tfc.connecttotfs.unabletoconnect)&rd=true
But in section: "You receive this error when you try to connect to an on-premises TFS from your client computer " I didn't found solution. I also reinstalled Visual Studio but it didn't solved my problem.
How to solve this? Is there a way to check some logs or events to find a reason? Thanks in advance for your help.
Regards Pawel
To narrow down this problem, try the following actions:
1.check whether there is something wrong with user account
a) Connect to TFS with the same user on another machine.
b) Login in tfs web access in web browser with your account
2.Clear TFS local cache http://www.ewaldhofman.nl/post/2009/07/06/Clear-the-cache-of-TFS.aspx For TFS 2013 the default path: C:\Users\XXX\AppData\Local\Microsoft\Team Foundation\5.0\Cache

Resources