azure 具有托管身份的Logic应用程序中的数据工厂连接器的ARM模板

jxct1oxe  于 2023-01-14  发布在  其他
关注(0)|答案(2)|浏览(146)

我有一个逻辑应用程序,它使用Azure数据工厂操作“创建管道运行”,工作完美。
This is how the Logic App looks like
我使用的Azure Data Factory身份验证方法是“系统分配”托管身份。
在创建和测试Logic App之后,我现在想创建一个ARM模板,将其保存在代码存储库中以供部署,但我很难让ARM模板的身份验证部分工作。我不确定语法应该如何,在Microsoft文档中也找不到任何内容。
在Logic App资源中,我添加了:

  1. "identity": {
  2. "type": "SystemAssigned"
  3. }

Logic应用程序资源的连接部分如下所示:

  1. "$connections": {
  2. "value": {
  3. "azuredatafactory": {
  4. "connectionId": "[parameters('connections_azuredatafactory_externalid')]",
  5. "connectionName": "[parameters('connections_azuredatafactory_name')]",
  6. "connectionProperties": {
  7. "authentication": {
  8. "type": "ManagedServiceIdentity"
  9. }
  10. },
  11. "id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/francecentral/managedApis/azuredatafactory')]"
  12. }
  13. }
  14. }

这是连接器资源的样子(我想我在这里漏掉了一些东西(?)):

  1. {
  2. "type": "Microsoft.Web/connections",
  3. "apiVersion": "2016-06-01",
  4. "name": "[parameters('connections_azuredatafactory_name')]",
  5. "location": "francecentral",
  6. "kind": "V1",
  7. "properties": {
  8. "displayName": "[parameters('connections_azuredatafactory_displayname')]",
  9. "alternativeParameterValues": {},
  10. "parameterValueSet": {
  11. "name": "managedIdentityAuth",
  12. "values": {}
  13. },
  14. "statuses": [
  15. {
  16. "status": "Ready"
  17. }
  18. ],
  19. "api": {
  20. "id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/francecentral/managedApis/azuredatafactory')]"
  21. }
  22. }
  23. }

尝试通过Visual Studio 2022部署此应用程序时收到的错误消息是:

模板部署返回以下错误:资源Microsoft.Logic/工作流“logic-d365-dwh-01-ip-dev-rxlse”失败,并显示消息“{“错误”:{“代码”:“工作流管理身份配置无效”,“消息”:“工作流连接参数”azuredatafactory“无效。API连接”azuredatafactory“未配置为支持托管标识。”}}“

有谁知道是什么问题吗?

ljsrvy3e

ljsrvy3e1#

1)我已经用3个动作(http请求,创建ADF管道,响应)创建了azure logic应用程序。
以下是参考图像:

2)然后使用系统分配的托管标识连接到ADF,我已经为逻辑应用程序提供了在ADF中创建管道的权限。
以下是参考图像:

1.然后我在门户网站上测试了一下,它是冲击的
1.然后我导出了ARM模板并下载。
1.然后在Visual Studio中,我创建了Azure资源组类型的新项目,然后编辑了基于模板的logicapp.json和逻辑应用程序参数文件。
1.然后我把它展开,它就被震动了。
ARM模板代码,我有参考:

  1. {
  2. "$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"),
  3. "contentVersion": "1.0.0.0",
  4. "parameters": {
  5. "workflows_so1LP_name": {
  6. "defaultValue": "so1LP",
  7. "type": "String"
  8. },
  9. "connections_azuredatafactory_1_externalid": {
  10. "defaultValue": "/subscriptions/<subscription-id>/resourceGroups/so1/providers/Microsoft.Web/connections/azuredatafactory-1",
  11. "type": "String"
  12. }
  13. },
  14. "variables": {},
  15. "resources": [
  16. {
  17. "type": "Microsoft.Logic/workflows",
  18. "apiVersion": "2017-07-01",
  19. "name": "[parameters('workflows_so1LP_name')]",
  20. "location": "centralus",
  21. "identity": {
  22. "type": "SystemAssigned"
  23. },
  24. "properties": {
  25. "state": "Enabled",
  26. "definition": {
  27. "$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"),
  28. "contentVersion": "1.0.0.0",
  29. "parameters": {
  30. "$connections": {
  31. "defaultValue": {},
  32. "type": "Object"
  33. }
  34. },
  35. "triggers": {
  36. "manual": {
  37. "type": "Request",
  38. "kind": "Http",
  39. "inputs": {}
  40. }
  41. },
  42. "actions": {
  43. "Create_a_pipeline_run": {
  44. "runAfter": {},
  45. "type": "ApiConnection",
  46. "inputs": {
  47. "host": {
  48. "connection": {
  49. "name": "@parameters('$connections')['azuredatafactory_1']['connectionId']"
  50. }
  51. },
  52. "method": "post",
  53. "path": "/subscriptions/@{encodeURIComponent('<subscription id>')}/resourcegroups/@{encodeURIComponent('so1')}/providers/Microsoft.DataFactory/factories/@{encodeURIComponent('sodf1')}/pipelines/@{encodeURIComponent('sopipeline')}/CreateRun",
  54. "queries": {
  55. "x-ms-api-version": "2017-09-01-preview"
  56. }
  57. }
  58. },
  59. "Response": {
  60. "runAfter": {
  61. "Create_a_pipeline_run": [
  62. "Succeeded"
  63. ]
  64. },
  65. "type": "Response",
  66. "kind": "Http",
  67. "inputs": {
  68. "statusCode": 200
  69. }
  70. }
  71. },
  72. "outputs": {}
  73. },
  74. "parameters": {
  75. "$connections": {
  76. "value": {
  77. "azuredatafactory_1": {
  78. "connectionId": "[parameters('connections_azuredatafactory_1_externalid')]",
  79. "connectionName": "azuredatafactory-1",
  80. "connectionProperties": {
  81. "authentication": {
  82. "type": "ManagedServiceIdentity"
  83. }
  84. },
  85. "id": "/subscriptions/<subscription-id>/<Subscriotion id>providers/Microsoft.Web/locations/centralus/managedApis/azuredatafactory"
  86. }
  87. }
  88. }
  89. }
  90. }
  91. }
  92. ],
  93. "outputs": {}
  94. }

以下是参考图像:

注:我使用免费订阅,所以我没有任何限制,但在你的情况下,也许你有一些限制,这就是为什么也许你面临的问题。
1.第二个原因可能是您在创建逻辑应用程序后使用系统分配的访问权限来访问ADF &一旦检查您是否在创建ADF后提供托管身份,则也可以访问逻辑应用程序。因此,您可能跳过了其中一个托管身份,这就是ARM模板部署中出错的原因。因此,从ADF向逻辑应用程序和从逻辑应用程序向ADF提供访问权限。
以下是ADF逻辑应用程序的一些参考图像:
转到逻辑应用程序的"访问控制"。

选择所有者作为角色。

选择托管身份作为数据工厂。

以下是ADF到逻辑应用程序的一些参考图像:
进入数据工厂的"访问控制"。

选择所有者作为角色。

选择托管标识作为逻辑应用程序。

展开查看全部
xqnpmsa8

xqnpmsa82#

您是否尝试使用"parameterValueType": "Alternative"而不是"parameterValueSet"

  1. {
  2. "type": "Microsoft.Web/connections",
  3. "apiVersion": "2016-06-01",
  4. "name": "[parameters('connections_azuredatafactory_name')]",
  5. "location": "francecentral",
  6. "kind": "V1",
  7. "properties": {
  8. "displayName": "[parameters('connections_azuredatafactory_displayname')]",
  9. "customParameterValues": {},
  10. "parameterValueType": "Alternative"
  11. "api": {
  12. "id": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/francecentral/managedApis/azuredatafactory')]"
  13. }
  14. }
  15. }

相关问题