How to use Azure File Storage to move file from one file share to another

Lu Li 41 Reputation points
2021-06-09T08:25:51.61+00:00

Hi, I'm trying to figure out how to use logic apps to move files in Azure File Storage from one location to another location. For example,

I created source Azure file share /test/nav and uploaded 3 text files in there
also created destination Azure file share /test/westpac

My goal is to move those 3 text files from /test/nav to /test/westpac, below is some screenshots from my logic apps designer. Also i pasted my workflow json file.

My problem is i didn't receive any file in destination folder. Can anyone point me to right direction ?

103777-image.png

103783-image.png

{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"List_files": {
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"referenceName": "azurefile"
}
},
"method": "get",
"path": "/datasets/default/foldersV2/@{encodeURIComponent(encodeURIComponent('JTJmdGVzdCUyZm5hdg=='))}",
"queries": {
"nextPageMarker": "",
"useFlatListing": false
}
},
"runAfter": {},
"metadata": {
"JTJmdGVzdCUyZm5hdg==": "/test/nav"
}
},
"For_each": {
"type": "Foreach",
"foreach": "@Tomas Podoba ('List_files')?['value']",
"actions": {
"Copy_file": {
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"referenceName": "azurefile"
}
},
"method": "post",
"headers": {
"ReadFileMetadataFromServer": true
},
"path": "/datasets/default/copyFile",
"queries": {
"source": "@items('For_each')?['Path']",
"destination": "/test/westpac/@{items('For_each')?['Name']}",
"overwrite": true,
"queryParametersSingleEncoded": true
}
},
"runAfter": {}
}
},
"runAfter": {
"List_files": [
"Succeeded"
]
}
}
},
"triggers": {
"Recurrence": {
"type": "Recurrence",
"recurrence": {
"frequency": "Second",
"interval": 10
}
}
},
"contentVersion": "1.0.0.0",
"outputs": {}
},
"kind": "Stateful"
}

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
0 comments No comments
{count} votes

Answer accepted by question author
  1. MayankBargali-MSFT 70,991 Reputation points Moderator
    2021-06-09T10:35:15.82+00:00

    Hi @Lu Li

    It looks good and I will suggest you to review your run history logs for the Stateful trigger to know more details if there was any failure.
    I have tested the same and couldn't observe any issue. Attaching the code view

    103845-image.png

    103871-image.png

    103846-image.png

    103852-image.png

    Feel free to get back to me if you need any assistance.


1 additional answer

Sort by: Most helpful
  1. Alsalahi, Zakarya - Vendor 1 Reputation point
    2022-06-14T10:00:58.99+00:00

    I have a follow up question here. I the same scenario but in my case I have some big files that the azurefile actions cannot move because the copy step doesnt support chunking. I tried to look for some documentation to do this using azure functions but no luck. can anyone please help me share a link or something ?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.