英文:
Visual Studio 2022 caches old tenant id, can't get rid of it
问题
Visual Studio 在尝试使用集成的 Microsoft 身份验证平台工具登录 Azure 时选择了错误的租户 ID。它显示给我的 GUID 我并没有这样的,我的租户 ID GUID 对于该用户是不同的,错误消息中显示的用户名是正确的。我尝试在 Azure 门户中搜索它显示给我的 GUID(以 f8cd... 开头),但没有找到任何信息,不知道 Visual Studio 是从哪里获取的,可能是我很久以前使用过的一个旧的 GUID。
当我在命令提示符中键入 az account show
时,它显示了正确的用户和正确的租户 ID,与主租户 ID 匹配。
在 Visual Studio 设置中勾选/取消勾选框也没有帮助。
我尝试过重启 Visual Studio,重启 Windows,退出登录,重新登录,但都没有帮助。我还尝试清理 \AppData\Local\.IdentityService\AzureServiceAuth
文件夹,但也没有帮助。
英文:
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.
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
答案1
得分: 2
需要检查以下步骤:
-
缓存问题:
转到Visual Studio右上角的
帐户设置
,删除所有已登录的帐户,然后使用所需的帐户重新输入您的凭据。这将帮助您解决缓存问题。参考SO上的我的解决方法以获取更多相关信息。
-
转到
控制面板 >> 用户帐户 >> 凭据管理器 >> Windows凭据
按照图像所示删除Visual Studio凭据,然后添加它。
-
通过转到
工具 > 导入和导出设置 > 重置所有设置
或工具 >> 选项 >> 环境 >> 帐户 >> 清除所有已登录的帐户。
-
如果以上方法都无效,请尝试通过转到
控制面板 >> 程序和功能 >> Microsoft Visual Studio >> 更改 >> 修复
如果问题仍然存在,请卸载Visual Studio,然后从Visual Studio官方网站重新安装最新版本。
英文:
Need to check below steps:
- 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.
Refer SO worked by me for more relevant information.
- Goto the
control panel >> User accounts >> Credential Manager >> Windows Credentials
Remove the Visual Studio credentials as shown in the image and add it.
- 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.
- 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
If still the issue persists, uninstall the visual studio and reinstall it with the latest version from Visual studio official site.
答案2
得分: 0
我们遇到了相同的问题。原来我们设置了一个系统环境变量,它覆盖了在Visual Studio中登录的Azure帐户:
AZURE_TENANT_ID="XXXXXXXX-XXXX-...."
删除这个环境变量,并重新启动Visual Studio后,问题得以解决。
英文:
We were experiencing the same issues. Turns out we had a system environment variable set that was overriding the Azure account logged in within VS:
AZURE_TENANT_ID="XXXXXXXX-XXXX-...."
After removing this environment variable, and restarting Visual Studio, the problem was resolved.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论