英文:
migrate multiple files from one storage container to another container using azure logicapps
问题
我已经创建了逻辑应用,如图所示。我的要求是将输入容器中的所有文件/数据移动到同一存储和不同存储账户中的输出容器。
在存储账户容器图像中显示,我有多个文件,但是按照上述工作流程,我一次只能发送一个文件。
请详细告诉我如何一次发送多个文件的工作流程,以及如何在同一存储账户和不同存储账户中发送它们。
注意:我已按照提供的解决方案创建了工作流程,但正如您所看到的,我的要求是我希望输入容器中的所有文件都以相同的名称出现在输出容器中。
英文:
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.
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
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个文件的数据:
逻辑应用设计:
在"Get Blob"中添加 /conatinername/items('For_Each')['Name']
输出:
第二个文件:
代码视图:
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"For_each": {
"actions": {
"Get_blob_content_(V2)": {
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/files/@{encodeURIComponent(encodeURIComponent('/rithwik/',items('For_Each')['Name']))}/content",
"queries": {
"inferContentType": true
}
},
"runAfter": {},
"type": "ApiConnection"
}
},
"foreach": "@body('Lists_blobs_(V2)')?['value']",
"runAfter": {
"Lists_blobs_(V2)": [
"Succeeded"
]
},
"type": "Foreach"
},
"Lists_blobs_(V2)": {
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/foldersV2/@{encodeURIComponent(encodeURIComponent('JTJmcml0aHdpaw=='))}",
"queries": {
"nextPageMarker": "",
"useFlatListing": false
}
},
"metadata": {
"JTJmcml0aHdpaw==": "/rithwik"
},
"runAfter": {},
"type": "ApiConnection"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"manual": {
"inputs": {
"schema": {}
},
"kind": "Http",
"type": "Request"
}
}
},
"parameters": {
"$connections": {
"value": {
"azureblob": {
"connectionId": "/subscriptions/b83c/resourceGroups/rbojjae/providers/Microsoft.Web/connections/azureblob",
"connectionName": "azureblob",
"id": "/subscriptions/b83cf/providers/Microsoft.Web/locations/eastus/managedApis/azureblob"
}
}
}
}
}
通过这种方式,您可以循环遍历文件列表。
编辑:
要将文件复制到不同的存储账户,请使用"Copy Blob",然后更改连接:
编辑-2
输出:
设计:
"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:
Logic App Design:
In get blob add /conatinername/items('For_Each')['Name']
Output:
2nd file :
Code view:
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"For_each": {
"actions": {
"Get_blob_content_(V2)": {
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/files/@{encodeURIComponent(encodeURIComponent('/rithwik/',items('For_Each')['Name']))}/content",
"queries": {
"inferContentType": true
}
},
"runAfter": {},
"type": "ApiConnection"
}
},
"foreach": "@body('Lists_blobs_(V2)')?['value']",
"runAfter": {
"Lists_blobs_(V2)": [
"Succeeded"
]
},
"type": "Foreach"
},
"Lists_blobs_(V2)": {
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/foldersV2/@{encodeURIComponent(encodeURIComponent('JTJmcml0aHdpaw=='))}",
"queries": {
"nextPageMarker": "",
"useFlatListing": false
}
},
"metadata": {
"JTJmcml0aHdpaw==": "/rithwik"
},
"runAfter": {},
"type": "ApiConnection"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"manual": {
"inputs": {
"schema": {}
},
"kind": "Http",
"type": "Request"
}
}
},
"parameters": {
"$connections": {
"value": {
"azureblob": {
"connectionId": "/subscriptions/b83c/resourceGroups/rbojjae/providers/Microsoft.Web/connections/azureblob",
"connectionName": "azureblob",
"id": "/subscriptions/b83cf/providers/Microsoft.Web/locations/eastus/managedApis/azureblob"
}
}
}
}
}
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:
Edit-2
Output:
Design:
st2 is conatiner in 2nd storage account.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论