0

enter image description here

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.

enter image description here

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.

frezsha
  • 3
  • 3
  • You have a list of blobs, therefore, throw a loop around the list. – Skin Jun 26 '23 at 09:54
  • @Skin thanks for your reply but i already tried for each loop then my workflow is failed. It would be great if you provide solution in detail by showing each actions of workflow then i will get a clear understand where i am doing mistake. – frezsha Jun 26 '23 at 09:58
  • @Skin Could you please check my question and provide relevant solution. – frezsha Jun 27 '23 at 10:08

1 Answers1

0

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:

enter image description here

Logic App Design:

enter image description here

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

enter image description here

Output:

enter image description here

2nd file :

enter image description here

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: enter image description here

enter image description here

Edit-2

Output:

enter image description here

Design:

enter image description here

st2 is conatiner in 2nd storage account.

RithwikBojja
  • 5,069
  • 2
  • 3
  • 7
  • thanks for the solution. You answered for with in storage account. I have mentioned different storage account also. please provide workflow for how to migrate all files in one storage container to another storage account container. – frezsha Jun 26 '23 at 10:18
  • Yeah next step will be for copy file – RithwikBojja Jun 26 '23 at 10:18
  • I can see copy blob action but there i can see only single storage account. Could you please edit your solution by showing workflow of migrate to different storage account and the output. – frezsha Jun 26 '23 at 10:23
  • I have edited my answer their you need to change to new connection to connect to or to copy to new storage account – RithwikBojja Jun 26 '23 at 10:25
  • I tried your approach but as you can see in my edited images i am not getting expected all files in output container . I want all 3 diff files as it is in input container in output container. I am getting all these 3 files as 1 file in output container but i want 3 diff files in output container also – frezsha Jun 27 '23 at 10:05
  • it would be great if you provide relevant solution. – frezsha Jun 27 '23 at 10:07
  • I haver edited my answer in Edit 2 – RithwikBojja Jun 27 '23 at 10:15
  • Did it Work ? @frezsha, You need to just use ```items('For_Each')['Name']``` in blob name place. – RithwikBojja Jun 27 '23 at 10:21