[英]ARM template for Data Factory connector in Logic Apps with Managed Identity
我有一个逻辑应用程序,它使用 Azure 数据工厂操作“创建管道运行”,效果很好。
我使用的 Azure 数据工厂的身份验证方法是“系统分配”托管标识。
创建并测试逻辑应用程序后,我现在想创建一个 ARM 模板以将其保存在代码存储库中以供部署,但是我正在努力让 ARM 模板的身份验证部分正常工作。 我不确定语法应该如何,而且我在 Microsoft 文档中找不到任何内容。
在我添加的 Logic App 资源中:
"identity": {
"type": "SystemAssigned"
}
这是逻辑应用程序资源的连接部分的样子:
"$connections": {
"value": {
"azuredatafactory": {
"connectionId": "[parameters('connections_azuredatafactory_externalid')]",
"connectionName": "[parameters('connections_azuredatafactory_name')]",
"connectionProperties": {
"authentication": {
"type": "ManagedServiceIdentity"
}
},
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/francecentral/managedApis/azuredatafactory')]"
}
}
}
这就是连接器资源的样子(我想我在这里遗漏了一些东西(?)):
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[parameters('connections_azuredatafactory_name')]",
"location": "francecentral",
"kind": "V1",
"properties": {
"displayName": "[parameters('connections_azuredatafactory_displayname')]",
"alternativeParameterValues": {},
"parameterValueSet": {
"name": "managedIdentityAuth",
"values": {}
},
"statuses": [
{
"status": "Ready"
}
],
"api": {
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/francecentral/managedApis/azuredatafactory')]"
}
}
}
尝试通过 Visual Studio 2022 部署它时收到的错误消息是:
模板部署返回以下错误:资源 Microsoft.Logic/workflows 'logic-d365-dwh-01-ip-dev-rxlse' 失败,消息为 '{“错误”:{“代码”:“WorkflowManagedIdentityConfigurationInvalid”,“消息”: “工作流连接参数‘azuredatafactory’无效。API 连接‘azuredatafactory’未配置为支持托管标识。” } }'
任何人都知道问题可能是什么?
1)我创建了具有 3 个操作(http 请求、创建 ADF 管道、响应)的 azure 逻辑应用程序。
这是参考图像:
2)然后使用系统分配的托管身份连接到 ADF,并且我已授予逻辑应用程序访问权限以在 ADF 中创建管道。
这是参考图像:
然后我在门户网站中进行了测试,并且成功了
然后我导出了 ARM 模板并下载。
然后在 Visual Studio 中,我创建了 Azure 资源组类型的新项目,然后我编辑了 logicapp.json 和基于模板的逻辑应用程序参数文件。
然后我已经部署了它并且成功了。
我用作参考的 ARM 模板代码:
{
"$schema": "[https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#"](https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#%22 "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#%22"),
"contentVersion": "1.0.0.0",
"parameters": {
"workflows_so1LP_name": {
"defaultValue": "so1LP",
"type": "String"
},
"connections_azuredatafactory_1_externalid": {
"defaultValue": "/subscriptions/<subscription-id>/resourceGroups/so1/providers/Microsoft.Web/connections/azuredatafactory-1",
"type": "String"
}
},
"variables": {},
"resources": [
{
"type": "Microsoft.Logic/workflows",
"apiVersion": "2017-07-01",
"name": "[parameters('workflows_so1LP_name')]",
"location": "centralus",
"identity": {
"type": "SystemAssigned"
},
"properties": {
"state": "Enabled",
"definition": {
"$schema": "[https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#"](https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#%22 "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#%22"),
"contentVersion": "1.0.0.0",
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"manual": {
"type": "Request",
"kind": "Http",
"inputs": {}
}
},
"actions": {
"Create_a_pipeline_run": {
"runAfter": {},
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azuredatafactory_1']['connectionId']"
}
},
"method": "post",
"path": "/subscriptions/@{encodeURIComponent('<subscription id>')}/resourcegroups/@{encodeURIComponent('so1')}/providers/Microsoft.DataFactory/factories/@{encodeURIComponent('sodf1')}/pipelines/@{encodeURIComponent('sopipeline')}/CreateRun",
"queries": {
"x-ms-api-version": "2017-09-01-preview"
}
}
},
"Response": {
"runAfter": {
"Create_a_pipeline_run": [
"Succeeded"
]
},
"type": "Response",
"kind": "Http",
"inputs": {
"statusCode": 200
}
}
},
"outputs": {}
},
"parameters": {
"$connections": {
"value": {
"azuredatafactory_1": {
"connectionId": "[parameters('connections_azuredatafactory_1_externalid')]",
"connectionName": "azuredatafactory-1",
"connectionProperties": {
"authentication": {
"type": "ManagedServiceIdentity"
}
},
"id": "/subscriptions/<subscription-id>/<Subscriotion id>providers/Microsoft.Web/locations/centralus/managedApis/azuredatafactory"
}
}
}
}
}
}
],
"outputs": {}
}
这是参考图像:
注意:我使用的是免费订阅,所以我没有任何限制,但在你的情况下,也许你有一些限制,这就是你面临问题的原因。
以下是逻辑应用程序到 ADF 的一些参考图像:
Go 对逻辑应用程序的“访问控制”。
Select 所有者作为角色。
Select 作为数据工厂管理身份。
以下是 ADF 到逻辑应用程序的一些参考图像:
Go 对数据工厂的“访问控制”。
Select 所有者作为角色。
Select 作为逻辑应用程序管理身份。
您是否尝试使用"parameterValueType": "Alternative"
而不是"parameterValueSet"
?
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[parameters('connections_azuredatafactory_name')]",
"location": "francecentral",
"kind": "V1",
"properties": {
"displayName": "[parameters('connections_azuredatafactory_displayname')]",
"customParameterValues": {},
"parameterValueType": "Alternative"
"api": {
"id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/francecentral/managedApis/azuredatafactory')]"
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.