【Azure Developer】VS Code上登录China Azure遇见错误:CAA20002 - LuBu0505/My-Code GitHub Wiki

问题描述

如果使用VS Code,在安装了Azure Resource插件后,修改它的云环境可以登录到中国区Azure。

设置 --> 输入“microsoft account” 关键字过滤 -->  修改Environment 值为ChinaCloud image.png

但是,如果遇见了 Error Code : CAA20002,错误消息:AADSTS65002: Consent between first party application 'aebc6443-996d-45c2-90f0-388ff96faa56' and first party resource '797f4846-ba00-4fd7-ba43-dac1f8f63013' must be configured via preauthorization - applications owned and operated by Microsoft must get approval from the API owner before requesting tokens for that API. Trace ID:xxxxxxxxxxx。

错误截图: image.png

是否有其它办法来解决这个问题呢?

问题解答

当然,解决办法是把Account的 Client ID Version修改为v2。 

Microsoft-authentication: Client ID Version

The version of the Microsoft Account client ID to use for signing in with a Microsoft account. Only change this if you have been asked to. The default is v1.

修改步骤

打开VS Code 设置页面 “Setting” ---> 输入 "microsoft account" 过滤配置  ---> 在Microsoft中找到Client ID Version  --->修改值为 v2 image.png

测试登录成功!

参考资料

VS Code Could not login to Azure : https://github.com/microsoft/vscode/issues/244689

当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!