question

LuLi-9013 avatar image
0 Votes"
LuLi-9013 asked AlsalahiZakaryaVendor-5013 answered

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

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": "@body('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
image.png (71.7 KiB)
image.png (79.1 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MayankBargali-MSFT avatar image
0 Votes"
MayankBargali-MSFT answered MayankBargali-MSFT commented

Hi @LuLi-9013

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.


codeview.txt (2.6 KiB)
image.png (23.9 KiB)
image.png (24.1 KiB)
image.png (26.0 KiB)
image.png (57.5 KiB)
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for your help.

I did another trigger, this time the workflow is working, and i am able to see files arrived in destination folder.But when i check run history, i can see a failed information, please see below screenshot.

103970-image.png


0 Votes 0 ·
image.png (72.1 KiB)

Basically i just want to confirm if i can ignore this failed message

0 Votes 0 ·

@LuLi-9013 To know the failure reason you need to click on "Next" and see the reason for the failure. If you know that for some of your workflow logic/file can be failed and that are expected and want to continue then you can write your own condition inside the for each action to ignore the Copy file action which makes it fail.

0 Votes 0 ·
AlsalahiZakaryaVendor-5013 avatar image
0 Votes"
AlsalahiZakaryaVendor-5013 answered

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 ?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.