Visual Studio 2017 - How to fix error: We could not refresh the credentials for the account - visual-studio

My email address has changed and now I can't log into Visual Studio 2017.
The error is "We could not refresh the credentials for the account. Failed to refresh the access token".
How can I fix this?

This bug will be fixed in a future version.
For now:
Close down VS2017
Go to "C:\Users\{username}\AppData\Local\.IdentityService"
Rename "IdentityServiceAdalCache.cache" as shown below. (for example just add an underscore to it)
Restart VS2017 and log in.
NOTE: There are similar issues that this won't resolve, but this worked for me.

Open Visual Studio. Click Help, Send Feedback, Report a Problem...
This brings you to a login screen. If you log in from there, it will log you into Visual Studio.

What worked for me was to rename .identityservice and then restart VS and log in to your VSTS account. It then recreates a new .identityservice that it can access.

I tried by deleting only the IdentityServiceAdalCache.cache as in the accepted answer but it did not fix the problem.
For the record, I managed to fix it by deleting every files within the .IdentityService folder (located in C:\Users{username}\AppData\Local.IdentityService).

I have read dozens of posts on this topic discussing clearing out .IdentityService. I tried every variation of this solution that one might think of. None worked.
I ended up poking around and trying to manually login to my Microsoft account using Internet Explorer, but I could not connect to https://login.microsoftonline.com. I added the https://login.microsoftonline.com address to my Trusted Sites in Internet Options. Once I had done this, Visual Studio was able to connect to Microsoft and validate my account.

When an error occurs, Visual studio will log it's error messages in the following folder. Please check the logs located at
%Temp%\servicehub\logs
This can also be caused by network restrictions. Please disable your virus guard or firewall and check.

This issue can also be caused by running VS "As Administrator" and the administrator is a different user. Just some FYI.
None of these answers will resolve that issue unfortunately.

Very old thread but if someone is still having this issue, then try following in my footsteps:
I just deleted the entire .IdentityService folder, and launched visual studio again... It asks you to log in and works normally. (for me)

Make sure you can access https://login.microsoftonline.com
If your network is blocking that (perhaps to block Microsoft webmail), then the above solutions will not pertain to you. Either unrestrict access, or you will need some off-line version.

In case someone is still looking for an answer. What worked for me was checking that the AppData folder and Local folder were not on 'read only mode' in the path "C:\Users{username}\AppData\Local.IdentityService" and it just worked!

Check to make sure that your PC no limit(IP-Firewall) to Internet connection access.
Disable or turn off VPN

It happened to me when using an account that uses my organization's email-domain, and I guess it tried to verify it and it couldn't find it in their database, and as soon as I used an account with a onmicrosoft.com domain, it worked.
The interesting part is that it allowed me to create the Microsoft account with this organization email and I still use it for DevOps, and it just stopped me when signing in with Visual Studio, I don't understand why this difference is.
I hope this can help someone..

I have VS 2017 and had this exact issue. Simply deleting
C:\Users\{username}\AppData\Local.IdentityService did not work for me.
Follow the steps 1-2 below to see if you might have and identical cause of the problem, and the rest how to solved it if so.
Go to C:\Users\{user}\AppData\Local\Temp\servicehub\logs and open the latest error logs from VS.
IF you see "Retrieved tenant memberships, found '2' owned tenants", then follow the rest of the steps.
Go to azure portal then login under the username you are
trying to use.
The following steps may change by the time you read this, but you
want to get to step 6. Go to Manage Azure Directory.
Click "Switch Tenants"
I was linked to 2 tenants, one of which I did not need. This is what had been causing my issues. Select the useless tenants, and click "leave tenant".
Once this is completed, close all instances of VS.
Delete C:\Users\{username}\AppData\Local.IdentityService.
Open VS and login to your account.

I found the same behavior when using Administrator user.
Any other user can login and activate the license only for himself.
I don't think there is a way to activate for Administrator, which makes using this licensing awkward for usage in a shared resource (i.e. build server).

The one solution which worked for me was resetting the domain password and restarting the system.
I just wanted to share this because i was struggling with the same problem since 8 days tried everything on net and this worked.
Hope it helps someone :)

I updated Visual Studio with latest package and after rebooting my PC issue was solved. I was able to log-in

Opening VS as admin worked for me, none of the above did

I was getting this error from our proxy having restrictive rules in place, I was able to add the sites to a whitelist that were being blocked while trying to login.
Some of the sites I whitelisted in Webmarshal were:
*.windows.net
*.msocsp.com
*.ws.symantec.com
*.digicert.com
*.clicktale.net
app.vssps.visualstudio.com
demdex.net

For me it was due wrong system time, after setting correct time it got fixed automatically

I had the problem of not being able to sign in to VS after not using unity for a long time and then updating everything. The way I solved it was to open VS and then click help. This opened the sign in box with 'Personalization Account'. I clicked 'Account options' under the afore mentioned heading, and changed the 'Embedded web browser' to 'System web browser' in the right window. This enabled me to log in via my Edge browser and everything worked fine.

I just fixed it by changing folder to be public.
folder files: "C:\Users{username}\AppData\Local.IdentityService"
right click and choose property and uncheck the hidden and apply it.

If you are under a domain network there is a workaround (quick fix),
Adding or changing the following key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\Protect\Providers\df9d8cd0-1501-11d1-8c7a-00c04fc297eb
ProtectionPolicy = 1 (DWORD)
Check the most recent modified files at %temp%\servicehub\logs.
Check StorageUtilitiesSingleton-10788-lqnuymos-1.log
For an error like this: The computer must be trusted for delegation and the current user account must be configured to allow delegation.
If that is the case this might help you.

I has this issue recently.
Tried all the options above, none worked.
Get it sorted, after repairing Visual Studio, doing all the updates, restart and updated again, restart, another repair and bang! Worked like a charm.

Instead of doing all this, change embedded broswer to system browser so it will works normally in default browser and gets updated in VS.

In VS 2019 enabling System Web Browser instead of Embedded web browser fixed it for me,
Hope this helps someone
https://learn.microsoft.com/en-us/visualstudio/ide/work-with-multi-factor-authentication?view=vs-2019

I tried multiple things above such as
Renaming c:\users[user]\appdata\local.IdentityService
Logging directly in https://login.microsoftonline.com (noticed certificate issues)
Adding https://login.microsoftonline.com to the Trust Sites list in Internet Options
Opening VS as non-admin as well as admin
Reviewed the logs here: %Temp%\servicehub\logs
I also installed Chrome, setting it to the default browser, because many features were saying IE is no longer supported
Reviewing the logs gave me the clue I needed to solve my particular issue. The log stated there was an issue with SSL trust.
Consequently, I ran our local version of rootsupd.exe and installed any related Microsoft root certificates such as the DigiCert Global Root G2 to the Trusted Root Authorities. After rebooting my machine, I noticed VS began recognizing my account and was actually already signed in.

Related

ERROR_USER_UNAUTHORIZED visual studio 2019 deploy IIS. Noob

I'm setting up an asp.net server for school and I am getting ERROR_USER_UNAUTHORIZED.
I have looked over the internet and everyone says that it has to do with not being administrator or not having access to the site. I am just getting confused. I added the user to the local administrator group. added him to iis manager permissions and to IIS manager users in like 3 different ways (same user different type of name, with server/name, name, iis manager user name).
Man I am just trying to publish to this server and I've been at it for like 5 hours (not that much but still I havent gotten any further at all).
To give some more detail:
I setup a publish profile in visual studio, correct host, username,password,site name and I think correct url (we have no dns setup yet so its just the ip of the server). INTERESTING PART HERE (I Think) when I click validate connection it works correctly (in edit) but when I publish it gives the error stated above. Also when I change https to http in the url it makes the error ERROR_USER_NOT_ADMIN, which the user is... .
To summarize, I have no clue what I am doing please help me god.
Take as long as you want to, I just want to get this done.
Check if you open VS with administrative right?
I forgot to mark this as solved and post the solution.
Apparently the solution was that I didn't mark the folder(inside the site in iis manager) as an application.
Solution is simply, open iis, select the server, select the site, right click the main folder with all your stuff, click mark as application.
I couldn't find this anywhere on the internet or on the help page it shows but it solved the problem. (litterally just started to turn insane a bit after trying stuff for 5 hours so stopped and went at it again next day and solved it in 5 minutes).

Unable to publish Windows Phone 8.1 application from Visual Studio 2013 Express

When I click on Store Menu -> Associate App with the Store ... OR Create App Packages I got the following error:
An unexpected network error has occurred. The app list cannot be refreshed. Please retry by pressing the Refresh button.
Even I can't upload the appx files because it fails when checking the app identity and publisher ...
I appreciate your help
Thanks
Sam
We are facing the same issue. This thread here says something about large number of apps that could be the reason. We have only 3 apps on the list. So it doesn't really seem to be the reason. Its the same with both Windows Phone and the Store apps. Accessing dashboard in the browser seems to be unaffected.
Also, I tried different ISPs to rule out that reason.
There seems to be a store problem. I'm talking to Microsoft's support, trying to get a feedback for the service to be back up.
Update:
Microsoft seems to have fixed the issue, which really was on their side.
Please, try again, as it should be all ok now. I've tested and it is all working.
I was facing this issue for the last 2 days. It works fine now. It was probably due to the account migration(so not all user would have faced this issue) and unrelated to the count of apps.
Can you try again?
Thank you all, it seems to be working now, MS fixed the issue.

Can't access microsoft.com and skype.com web site after installing VS2013 Preview

Recently i installed Microsoft Visual Studio 2013 Preview Ultimate on Windows 7. Everything went smoothly except now i can't access www.microsoft.com and www.skype.com anymore. Tried latest IE10 and FireFox, both show blank page when accessing the above mentioned web sites. Firefox in its left bottom corner shows that it is waiting for ajax.aspnetcdn.com.
I'd really like not to reinstall OS on my machine, so i'd appreciate any idea how to fix this. For myself i tried to stop Firewall service and disable MS Security Essentials runtime protection, neither helped.
PS: I can access www.microsoft.com and www.skype.com from another machine in the same local network
UPDATE: i am using tfs.visulstudio.com as my TFS server and it opens fine if i am not signed in. But once i am trying to log in it opens blank, like browser is waiting for something (the same as for microsoft.com and skype.com). Something related to live ID?
Don't think this is the website to post this kind of question but try uninstalling VS2013 preview because you think that's causing the problem. Search in Google for people getting similar problem. I also don't think it is VS2013 because I can't think of anyway of how VS2013 would somehow disable you from going to a certain website. Make sure the sites weren't down at the time or if you're having something kind of Internet server issues.
skype is owned by microsoft, so you can't enter both microsoft pages. This could be related with some kind of ISP (Internet Service Provider) and not with VS2013, or you can try rebooting your router. Last thing i would do is traceroute both address and see where they fall.
I wanted to write this as a comment but I don't have enough reputation yet. Anyway, obviously trying to uninstall the program and trying again would be a good start as already mentioned, but you should also look inside your hosts file for any weird redirections some virus of malware might have set up. It's located at "C:\Windows\System32\drivers\etc" and you can open this inside notepad (might require notepad to be run as an administrator). Check to see if skype.com or microsoft.com are in there and are pointing to a different IP address. If they are you can just remove them and save the file (might require a restart to take effect). If still no luck you should try a livecd of a linux distro to make sure the problem is definitely inside your windows somewhere.
Let us know how it goes.

CacheInstaller.exe has stopped working

I am having below mentioned issue when I am running Asp.Net MVC 2 project on windows Azure emulator (dev environment)
I have installed Windows Azure SDK for .NET - October 2012 version and I am using cache feature on my system.
With above error Below one is also comming.
How to get rid of this ?
Maybe I have an stupid solution, but that works with me.
When I begin to recieve the message "CacheInstaller.exe has stopped working", I do the following:
1) Stop the execution.
2) Go to the Role I'm using in the Azure project and open the corresponding Properties page.
3) Go to the "Caching" section and there I uncheck the "Enable Caching" checkbox. After that I checked again.
4) Save*, Run de application and never the warning appear again.
Is weird because nothing should change if you uncheck and check it again an option without save in the middle, but in this case when you do that the file changes (I can see it in the red icon that said something change there, :P)
I hope this helps. Cheers.
Do you have any error messages in the event log that may give more hint.
It could be an issue with missing dlls, do you have the windows server appFabric installed as well on this machine, which may be leading to a conflict with the dlls?
A procmon log might help you see what file paths its looking for.
"http://technet.microsoft.com/en-us/sysinternals/bb896645"
I banged my head against the wall on this one as well. I finally figured out the problem after digging deep into the crash-dump logs located within: C:\Users\{YOU}\AppData\Local\dftmp\Resources\{GUID}\directory\DiagnosticStore\AzureCaching\
AzureCaching does not allow UNC paths.
As my primary .net dev is from a vm, my documents/projects drive is mapped to my native drive located at: \\psf\Home\Documents\... Once I moved the project to the vm c:/ drive, CacheInstaller worked as intended.
Might as well post my experience as I was unable to locate anything on this specific problem.
I found today that if my system time was more than about 10 minutes wrong then CacheInstaller.exe bailed out on starting the emulator.
That includes the combination of system time and timezone being wrong, presumably as it results in an inability to calculate the correct UTC time at which Azure operates. Fixing the system clock resolved the issue in my case.

Visual Studio 2010 Debug Server Not Recognizing My Changes

Using Visual Studio 2010 on Window 7 64bit. I'm trying to test a website project (not a web application project) using the built in dev server (cassini). The problem I'm having is that when I make a change, I now have to actually stop debugging, kill cassini, and restart before I can actually see my changes in the browser. I used to be able to edit and refresh. One of my fellow developers here is able to do this just fine with an identical setup (same project/vs version/os - and settings near as I can tell). I'm beginning to suspect some sort of permissions issue. I've been all over google trying to find an answer to no avail. Any ideas?
As it turns out, this was my fault... I had experienced the dreaded "network BIOS command limit has been reached" issue. I found a post that recommended doing a regedit hack "HKLM\Software\Microsoft\ASP.NET\FCNMode = 1", well this basically turns off File Change Notifications. Changing this value to 2, and applying the changes recommended in knowledge base 810886 fixed both problems.

Resources