【Azure Developer】use @azure/arm-monitor sdk 遇见 ManagedIdentityCredential authentication failed.(status code 500)

问题描述

在使用 @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.

 

问题解决

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

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

即可解决问题。

 

 

参考资料

 

 

posted @ 2023-08-22 19:36  路边两盏灯  阅读(18)  评论(0编辑  收藏  举报