azurevisual-studio

Visual Studio 2022 caches old tenant id, can't get rid of it


Visual Studio picks the wrong tenant id in an attempt to login Azure in the integrated Microsoft Identity platform tool, I do not have such a GUID that it shows me, my tenant id Guid is different for the user, and user name is shown right in the error message. I tried to search the GUID that it shows me (starting at f8cd..) in Azure portal, but was not able to find anything, no idea where VS takes it from, could be some old one that I used long in the past.

enter image description here

I restarted studio, rebooted Windows, signed out, signed in, nothing helps. I clean up \AppData\Local\.IdentityService\AzureServiceAuth, it did not help either.

When I type az account show in the cmd, it displays right user and right tenant id with home tenant id

Checking/unchecking the box in VS settings does not help either enter image description here


Solution

  • Need to check below steps:

    1. Cache issue:

    Goto the account settings on the top right corner of the Visual studio and remove all the existed logged in accounts and reenter your credentials with the required one. This will help you to resolve the cache issue.

    enter image description here

    Refer SO worked by me for more relevant information.

    1. Goto the
    control panel >> User accounts >> Credential Manager >> Windows Credentials
    

    Remove the Visual Studio credentials as shown in the image and add it.

    enter image description here

    1. Reset all settings in Visual Studio by going to Tools > Import and Export Settings > Reset all settings.

    Or

    Tools >> Options >> Environment >> Accounts >> Clear all the logged in accounts.
    

    enter image description here

    1. If none of the above works, try repairing the Visual Studio installation by going to
    Control Panel >> Programs and Features >> Microsoft Visual Studio >> Change >> Repair
    

    enter image description here

    If still the issue persists, uninstall the visual studio and reinstall it with the latest version from Visual studio official site.