【Azure Function App】在ADF(Azure Data Factory)中调用 Azure Function 时候遇见 Failed to get MI access token

简介: 【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

 

 

相关文章
|
5月前
|
Java 应用服务中间件 API
【App Service】部署War包到Azure云上遇404错误
Java应用部署至Azure App Service for Windows后报404,本地运行正常。经排查,日志提示类文件版本不兼容:应用由Java 17(class file version 61.0)编译,但环境仅支持到Java 11(55.0)。错误根源为Java版本不匹配。调整App Service的Java版本至17后问题解决,成功访问接口。
316 3
|
5月前
|
存储 Linux 网络安全
【Azure App Service】Root CA on App Service
Azure App Service for Windows应用连接外部SSL服务时,需确保其证书由受信任的根CA颁发。多租户环境下无法修改根证书,但ASE(单租户)可加载自定义CA证书。若遇证书信任问题,可更换为公共CA证书或将应用部署于ASE并导入私有CA证书。通过Kudu的PowerShell(Windows)或SSH(Linux)可查看当前受信任的根证书列表。
134 14
|
6月前
|
API 网络架构 容器
【Azure Container App】查看当前 Container App Environment 中的 CPU 使用情况的API
在扩展 Azure Container Apps 副本时,因 Container App Environment 的 CPU 核心数已达上限(500 cores),导致扩展失败。本文介绍如何使用 `az rest` 命令调用 Azure China Cloud 管理 API,查询当前环境的 CPU 使用情况,并提供具体操作步骤及示例。
206 17
|
6月前
|
数据安全/隐私保护
【Azure Function App】PowerShell Function 执行 Get-AzAccessToken 的返回值类型问题:System.String 与 System.Security.SecureString
将PowerShell Function部署到Azure Function App后,Get-AzAccessToken返回值类型在不同环境中有差异。正常为SecureString类型,但部分情况下为System.String类型,导致后续处理出错。解决方法是在profile.ps1中设置环境变量$env:AZUREPS_OUTPUT_PLAINTEXT_AZACCESSTOKEN=false,以禁用明文输出。
177 1
|
开发工具 数据安全/隐私保护 安全
远程调试 Azure Web App
当我们将 Web App 部署在 Azure 上时,如果能够实现远程调试,将会极大的提高我们修复 bug 的效率。Visual Studio 一贯以功能强大、易用著称,当然可以实现基于 Azure 应用的创建、发布和调试。
1273 0
|
5月前
|
缓存 移动开发 JavaScript
如何优化UniApp开发的App的启动速度?
如何优化UniApp开发的App的启动速度?
984 139