通过ADF中的Web活动对Azure Web作业进行MSI身份验证会给出错误403-此Web应用已停止。问题,而通过基本身份验证调用了同一Web作业。
该Web作业作为手动触发托管在Windows App Service上。
在ADF V2中,我创建了一个网络活动并提供了以下设置:URL:https://<web app name>.scm.azurewebsites.net/api/triggeredwebjobs/<webjobname>/run
Method: POST
Headers: NA
Body: {}
Authentication: MSI with resource as https://management.azure.com/
注意:分配角色并启用MSI后,我也重新启动了我的App Service。
这是adf中网络活动的代码:
{
"name": "pipeline1",
"properties": {
"activities": [
{
"name": "Web1",
"type": "WebActivity",
"dependsOn": [],
"policy": {
"timeout": "7.00:00:00",
"retry": 0,
"retryIntervalInSeconds": 30,
"secureOutput": false,
"secureInput": false
},
"userProperties": [],
"typeProperties": {
"url": "https://<webappname>.scm.azurewebsites.net/api/triggeredwebjobs/<webjobname>/run",
"method": "POST",
"authentication": {
"type": "MSI",
"resource": "https://management.azure.com/"
}
}
}
],
"annotations": []
},
"type": "Microsoft.DataFactory/factories/pipelines"
}
我希望身份验证成功,并且应该触发Web作业,但是实际上Web应用没有通过MSI身份验证调用,并且活动失败,输出为错误403-此Web应用已停止
。答案 0 :(得分:1)
您需要将url
更改为https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/triggeredwebjobs/{webJobName}/run?api-version=2016-08-01
,然后它将正常工作。
参考-Web Apps - Run Triggered Web Job
测试结果:
答案 1 :(得分:0)
大多数MSDN文档都指出,为了对SCM站点进行身份验证,应使用基本身份验证。参考: https://github.com/projectkudu/kudu/wiki/WebJobs-API#invoke-a-triggered-job
但是我能够发现,为了使用MSI对SCM站点进行身份验证,资源应为'https://management.core.windows.net/',而不是'https://management.azure.com'。
要回答上述问题,只需更改“身份验证”中的资源,如下所示:
Authentication: MSI with resource as https://management.azure.com/
参考链接: https://github.com/projectkudu/kudu/issues/2957#issuecomment-477890719 ,其中指出
在请求MSI令牌时,您必须定义 https://management.core.windows.net/作为资源而不是 https://management.azure.com/。
我当然相信这可能对使用MSI身份验证访问KUDU有所帮助。