启动Azure Data Factory管道所需的API权限是什么?

问题描述

我需要按照https://docs.microsoft.com/en-us/rest/api/datafactory/pipelines/createrun#code-try-0

从REST API启动Azure数据工厂管道

我已经创建了一个AAD应用程序,并为其提供了 Azure服务管理 API权限。但是,当客户端通过OAuth2隐式流接收到id_token并调用该API来启动管道时,我会得到

{
    "error": {
        "code": "InvalidAuthenticationToken","message": "The access token is invalid."
    }
}

我是否使用正确的API权限?谢谢。

解决方法

如果您只想使用OAuth2流来获取令牌来调用REST API,则在这种情况下,client credentials flow比隐式流更合适。

请按照以下步骤操作。

1。Get values for signing increate a new application secret

2。导航到数据工厂-> Access control (IAM)-> Add->将您的AD App添加为RBAC角色,例如ContributorOwnerData Factory Contributor,详细信息紧随this

3。在邮递员中,按照下面的截图,修复步骤1中获得的请求正文,然后使用令牌调用REST API,它将正常工作。

POST https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token

client_id=<client_id>
&scope=https://management.azure.com/.default
&client_secret=<client_secret>
&grant_type=client_credentials

enter image description here

,

我现在无法对其进行测试,但我认为拥有Data Factory Contributor就足够了。

https://docs.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#data-factory-contributor

enter image description here