如何在Azure上实施Web Activity时刷新我的访问令牌?
我做了以下工作:
1.创建了一个基于某些筛选器运行的Web Activity,使用:https://learn.microsoft.com/en-us/rest/api/datafactory/pipeline-runs/query-by-factory?tabs=HTTP
{
"name": "get pp1 runs based on filters",
"description": "get pp1 runs based on filters.",
"type": "WebActivity",
"dependsOn": [
{
"activity": "Lookup1",
"dependencyConditions": [
"Succeeded"
]
}
],
"policy": {
"timeout": "0.12:00:00",
"retry": 0,
"retryIntervalInSeconds": 30,
"secureOutput": false,
"secureInput": false
},
"userProperties": [],
"typeProperties": {
"url": "POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/queryPipelineRuns?api-version=2018-06-01",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"Authorization": "https://login.microsoftonline.com/common/oauth2/authorize"
},
"body": {
"lastUpdatedAfter": "2023-07-23T12:00:36.33Z",
"lastUpdatedBefore": "2023-07-24T12:01:35Z",
"filters": [
{
"operand": "pp1",
"operator": "Equals",
"values": [
"pipeline1"
]
}
]
},
"authentication": {
"credential": {
"referenceName": "credential_ref",
"type": "CredentialReference"
},
"type": "UserAssignedManagedIdentity"
}
}
},
字符串
我使用身份验证作为User Assigned Managed Identity
,集成运行时作为AutoResolveIntegrationRuntime
当我调试它时,它在这个webactivtiy上失败并给我错误:RefreshMsiAccessToken: accessToken null
个
我读了一些链接,这是因为令牌每30分钟到60分钟到期一次。如何每隔一小时连续(或在某个时间间隔内)调用访问令牌?
1条答案
按热度按时间83qze16e1#
当您创建了一个基于某些过滤器运行的Web活动时,使用:query-by-factory和Authentication与
User Assigned Managed Identity
一样,您不需要在web activity中提供Authorizationheader。您可以按照以下步骤操作:
1.在资源组中创建一个
User Assigned Managed Identity
。的数据
1.在Data Factory托管身份中添加
User Assigned Managed Identity
。的
1.在数据工厂中,您需要为托管身份提供数据工厂贡献者角色。
的
1.现在,在数据工厂中获取一个Web Activity,并将URL与身份验证一起传递为
User Assigned Managed Identity
,设置如下:的
我的管道.json:
字符串
输出:
流水线运行成功: