【Azure Function App】在ADF(Azure Data Factory)中调用 Azure Function 时候遇见 Failed to get MI access token
问题描述
在ADF(Azure Data Factory)中,调用Azure Function App中的Function,遇见了 Failed to get MI access token
There was an error while calling endpoint with error message - 'Failed to get MI access token. The error message is: Acquire MI token from AAD failed.
ErrorCode: invalid_resource,
Message: AADSTS500011: The resource principal named https://xxxxxxxxxx.chinacloudsites.cn was not found in the tenant named ***************.
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.
错误截图如下:
那么,如何来解决 Acquire MI Token from AAD Failed 的问题呢?
问题解答
出现Failed to get MI access token的问题,主要原因是: 在Azure Function Link Service 时,选择了Authentication Method为 System Assigned Managed Identity。
- 如果Funcation App没有启用认证(Authentication),只需要选择Anonymous(匿名)访问模式即可解决 Failed to get MI access token 问题。
- 但是只要选择了 System Assigned Managed Identity认证方式,在Resource ID的输入框中,没有输入任何内容。所以它默认使用了Function App 的 host url 作为 resource principal named。
如果输入的是其他值,则错误消息中,包含您输入的Resource ID值。如下图所示:
所以,解决这个问题的关键就是在ADF的Link Service中,配置正确的Resource ID(即被访问资源所生产的System Managed Identity App(Client) ID)。
具体的操作步骤,参考文章:https://www.cnblogs.com/lulight/articles/17195587.html
当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2022-03-08 【Azure Redis 缓存】当使用Azure Redis 集群服务时候,发生了Moved的几点分析
2022-03-08 【Azure API 管理】使用APIM进行XML内容读取时遇见的诡异错误 Expression evaluation failed. Object reference not set to an instance of an object.
2021-03-08 【Azure 应用服务】Azure SignalR 是否可以同时支持近十万人在线互动
2021-03-08 【Azure API 管理】从微信小程序访问APIM出现200空响应的问题中发现CORS的属性[terminate-unmatched-request]功能