【Azure Developer】use @azure/arm-monitor sdk 遇见 ManagedIdentityCredential auth
  ExOerB7z3frR 2023年11月13日 22 0

@azure/arm-monitor ManagedIdentityCredential authentication failed.(status code 500) CredentialUnavailableError: ERROR: AADSTS500011: The resource principal name https://management.azure.com was not found in tenant name ##############. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant.

问题描述

在使用 @azure/arm-monitor sdk 创建 MonitorClient对象时候,遇见错误 ManagedIdentityCredential authentication failed.(status code 500)

CredentialUnavailableError: ERROR: AADSTS500011: The resource principal name https://management.azure.com was not found in tenant name ##############. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant.

【Azure Developer】use @azure/arm-monitor sdk 遇见 ManagedIdentityCredential auth_ci

 

问题解决

在初始化 MonitorClient 对象时,添加 credentialScopes 参数:

credentialScopes: ['https://management.chinacloudapi.cn/.default']

即可解决问题。

【Azure Developer】use @azure/arm-monitor sdk 遇见 ManagedIdentityCredential auth_ci_02

 

 

参考资料

MonitorClient(TokenCredential, string, MonitorClientOptionalParams) : https://learn.microsoft.com/en-us/javascript/api/@azure/arm-monitor/monitorclient?view=azure-node-latest#@azure-arm-monitor-monitorclient-constructor

MonitorClient Optional Params credentialScopes : https://learn.microsoft.com/en-us/javascript/api/%40azure/arm-monitor/monitorclientoptionalparams?view=azure-node-latest#@azure-arm-monitor-monitorclientoptionalparams-credentialscopes

 

 

 

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



【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月13日 0

暂无评论

推荐阅读
  f18CFixvrKz8   2024年05月20日   90   0   0 JavaScript
  fxrR9b8fJ5Wh   2024年05月17日   52   0   0 JavaScript
  2xk0JyO908yA   2024年04月28日   40   0   0 JavaScript
ExOerB7z3frR