迁移多个文件从一个 Azure 存储容器到另一个容器,使用 Azure Logic Apps。

huangapple go评论93阅读模式
英文:

migrate multiple files from one storage container to another container using azure logicapps

问题

我已经创建了逻辑应用,如图所示。我的要求是将输入容器中的所有文件/数据移动到同一存储和不同存储账户中的输出容器。

在存储账户容器图像中显示,我有多个文件,但是按照上述工作流程,我一次只能发送一个文件。
请详细告诉我如何一次发送多个文件的工作流程,以及如何在同一存储账户和不同存储账户中发送它们。

我遇到的错误

我创建的工作流程

输入容器中的3个不同文件

执行上述工作流程后,如图所示,我能够获得输出容器中的内容

注意:我已按照提供的解决方案创建了工作流程,但正如您所看到的,我的要求是我希望输入容器中的所有文件都以相同的名称出现在输出容器中。

英文:

迁移多个文件从一个 Azure 存储容器到另一个容器,使用 Azure Logic Apps。

I have created logic app as shown in image. My requirement is moving all files/data in my input container to output container with in same storage and diff storage account.

迁移多个文件从一个 Azure 存储容器到另一个容器,使用 Azure Logic Apps。

As shown in storage account container image i have multiple files but i am able to send onle one file at a time by following above mentioned workflow.
please let me know the workflow in detail how can i send multiple files at a time with in same storage account and also different storage account.
error i am getting

workflow i created

3 different files in input container

After performing above workflow as said i able to get as shown in output container

Note: i have created workflow as provided in solution but as you can see my requirement is i want all files in input as it is in output container means i want those 3 input container files in output container with those names.

答案1

得分: 0

我在我的环境中进行了复制,并得到了如下的期望结果:

我的存储账户包含2个文件,以下设计获取了2个文件的数据:

逻辑应用设计:

迁移多个文件从一个 Azure 存储容器到另一个容器,使用 Azure Logic Apps。

在"Get Blob"中添加 /conatinername/items('For_Each')['Name']

迁移多个文件从一个 Azure 存储容器到另一个容器,使用 Azure Logic Apps。

输出:

迁移多个文件从一个 Azure 存储容器到另一个容器,使用 Azure Logic Apps。

第二个文件:

迁移多个文件从一个 Azure 存储容器到另一个容器,使用 Azure Logic Apps。

代码视图:

  1. {
  2. "definition": {
  3. "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
  4. "actions": {
  5. "For_each": {
  6. "actions": {
  7. "Get_blob_content_(V2)": {
  8. "inputs": {
  9. "host": {
  10. "connection": {
  11. "name": "@parameters('$connections')['azureblob']['connectionId']"
  12. }
  13. },
  14. "method": "get",
  15. "path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/files/@{encodeURIComponent(encodeURIComponent('/rithwik/',items('For_Each')['Name']))}/content",
  16. "queries": {
  17. "inferContentType": true
  18. }
  19. },
  20. "runAfter": {},
  21. "type": "ApiConnection"
  22. }
  23. },
  24. "foreach": "@body('Lists_blobs_(V2)')?['value']",
  25. "runAfter": {
  26. "Lists_blobs_(V2)": [
  27. "Succeeded"
  28. ]
  29. },
  30. "type": "Foreach"
  31. },
  32. "Lists_blobs_(V2)": {
  33. "inputs": {
  34. "host": {
  35. "connection": {
  36. "name": "@parameters('$connections')['azureblob']['connectionId']"
  37. }
  38. },
  39. "method": "get",
  40. "path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/foldersV2/@{encodeURIComponent(encodeURIComponent('JTJmcml0aHdpaw=='))}",
  41. "queries": {
  42. "nextPageMarker": "",
  43. "useFlatListing": false
  44. }
  45. },
  46. "metadata": {
  47. "JTJmcml0aHdpaw==": "/rithwik"
  48. },
  49. "runAfter": {},
  50. "type": "ApiConnection"
  51. }
  52. },
  53. "contentVersion": "1.0.0.0",
  54. "outputs": {},
  55. "parameters": {
  56. "$connections": {
  57. "defaultValue": {},
  58. "type": "Object"
  59. }
  60. },
  61. "triggers": {
  62. "manual": {
  63. "inputs": {
  64. "schema": {}
  65. },
  66. "kind": "Http",
  67. "type": "Request"
  68. }
  69. }
  70. },
  71. "parameters": {
  72. "$connections": {
  73. "value": {
  74. "azureblob": {
  75. "connectionId": "/subscriptions/b83c/resourceGroups/rbojjae/providers/Microsoft.Web/connections/azureblob",
  76. "connectionName": "azureblob",
  77. "id": "/subscriptions/b83cf/providers/Microsoft.Web/locations/eastus/managedApis/azureblob"
  78. }
  79. }
  80. }
  81. }
  82. }

通过这种方式,您可以循环遍历文件列表。

编辑:

要将文件复制到不同的存储账户,请使用"Copy Blob",然后更改连接:

迁移多个文件从一个 Azure 存储容器到另一个容器,使用 Azure Logic Apps。

迁移多个文件从一个 Azure 存储容器到另一个容器,使用 Azure Logic Apps。

编辑-2

输出:

迁移多个文件从一个 Azure 存储容器到另一个容器,使用 Azure Logic Apps。

设计:

迁移多个文件从一个 Azure 存储容器到另一个容器,使用 Azure Logic Apps。

"st2"是第二个存储账户中的容器。

英文:

I have reproduced in my environment and got expected results as below:

My Storage account contains 2 files and below design gets the data of 2 files:

迁移多个文件从一个 Azure 存储容器到另一个容器,使用 Azure Logic Apps。

Logic App Design:

迁移多个文件从一个 Azure 存储容器到另一个容器,使用 Azure Logic Apps。

In get blob add /conatinername/items('For_Each')['Name']

迁移多个文件从一个 Azure 存储容器到另一个容器,使用 Azure Logic Apps。

Output:

迁移多个文件从一个 Azure 存储容器到另一个容器,使用 Azure Logic Apps。

2nd file :

迁移多个文件从一个 Azure 存储容器到另一个容器,使用 Azure Logic Apps。

Code view:

  1. {
  2. "definition": {
  3. "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
  4. "actions": {
  5. "For_each": {
  6. "actions": {
  7. "Get_blob_content_(V2)": {
  8. "inputs": {
  9. "host": {
  10. "connection": {
  11. "name": "@parameters('$connections')['azureblob']['connectionId']"
  12. }
  13. },
  14. "method": "get",
  15. "path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/files/@{encodeURIComponent(encodeURIComponent('/rithwik/',items('For_Each')['Name']))}/content",
  16. "queries": {
  17. "inferContentType": true
  18. }
  19. },
  20. "runAfter": {},
  21. "type": "ApiConnection"
  22. }
  23. },
  24. "foreach": "@body('Lists_blobs_(V2)')?['value']",
  25. "runAfter": {
  26. "Lists_blobs_(V2)": [
  27. "Succeeded"
  28. ]
  29. },
  30. "type": "Foreach"
  31. },
  32. "Lists_blobs_(V2)": {
  33. "inputs": {
  34. "host": {
  35. "connection": {
  36. "name": "@parameters('$connections')['azureblob']['connectionId']"
  37. }
  38. },
  39. "method": "get",
  40. "path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/foldersV2/@{encodeURIComponent(encodeURIComponent('JTJmcml0aHdpaw=='))}",
  41. "queries": {
  42. "nextPageMarker": "",
  43. "useFlatListing": false
  44. }
  45. },
  46. "metadata": {
  47. "JTJmcml0aHdpaw==": "/rithwik"
  48. },
  49. "runAfter": {},
  50. "type": "ApiConnection"
  51. }
  52. },
  53. "contentVersion": "1.0.0.0",
  54. "outputs": {},
  55. "parameters": {
  56. "$connections": {
  57. "defaultValue": {},
  58. "type": "Object"
  59. }
  60. },
  61. "triggers": {
  62. "manual": {
  63. "inputs": {
  64. "schema": {}
  65. },
  66. "kind": "Http",
  67. "type": "Request"
  68. }
  69. }
  70. },
  71. "parameters": {
  72. "$connections": {
  73. "value": {
  74. "azureblob": {
  75. "connectionId": "/subscriptions/b83c/resourceGroups/rbojjae/providers/Microsoft.Web/connections/azureblob",
  76. "connectionName": "azureblob",
  77. "id": "/subscriptions/b83cf/providers/Microsoft.Web/locations/eastus/managedApis/azureblob"
  78. }
  79. }
  80. }
  81. }
  82. }

By this way you can loop the list of files.

EDIT:

To copy file to different storage account use Copy blob and now change the connection:
迁移多个文件从一个 Azure 存储容器到另一个容器,使用 Azure Logic Apps。

迁移多个文件从一个 Azure 存储容器到另一个容器,使用 Azure Logic Apps。

Edit-2

Output:

迁移多个文件从一个 Azure 存储容器到另一个容器,使用 Azure Logic Apps。

Design:

迁移多个文件从一个 Azure 存储容器到另一个容器,使用 Azure Logic Apps。

st2 is conatiner in 2nd storage account.

huangapple
  • 本文由 发表于 2023年6月26日 17:51:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/76555531.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定