-
Notifications
You must be signed in to change notification settings - Fork 0
【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']
即可解决问题。
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
当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!