Azure Logic Apps: Error when copying file from OneDrive to Azure File Storage

Jun Ting Ho 141 Reputation points

I am trying to copy a file from OneDrive to Azure File Storage but am unable to do so.

The flow ("Path" is supposed to be taken from "Get file metadata" of the file to be copied):


The error in visual form:


The raw output of the error:

    "statusCode": 400,  
    "headers": {  
        "Pragma": "no-cache",  
        "x-ms-request-id": "cb121159-f663-44f4-a5cc-2461150b3684",  
        "Strict-Transport-Security": "max-age=31536000; includeSubDomains",  
        "X-Content-Type-Options": "nosniff",  
        "X-Frame-Options": "DENY",  
        "Cache-Control": "no-store, no-cache",  
        "Set-Cookie": "ARRAffinity=9227faf24135ad53dd065beee547fecb0ff01774dd3486105eba5bed7b415073;Path=/;HttpOnly;Secure;,ARRAffinitySameSite=9227faf24135ad53dd065beee547fecb0ff01774dd3486105eba5bed7b415073;Path=/;HttpOnly;SameSite=None;Secure;",  
        "Timing-Allow-Origin": "*",  
        "x-ms-apihub-cached-response": "true",  
        "Date": "Wed, 07 Jul 2021 10:14:15 GMT",  
        "Content-Length": "250",  
        "Content-Type": "application/json",  
        "Expires": "-1"  
    "body": {  
        "status": 400,  
        "message": "File name is null or empty.\r\nclientRequestId: cb121159-f663-44f4-a5cc-2461150b3684",  
        "error": {  
            "message": "File name is null or empty."  
        "source": ""  

Does anyone know what I'm doing wrong and how to rectify it? Where does this "source" come from or what is it referring to?

EDIT: I saw somewhere that suggested to use "Create file" instead, but I cannot select anything in "Folder path" to do so with:


Azure Files
Azure Files
An Azure service that offers file shares in the cloud.
1,176 questions
Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,887 questions
OneDrive Management
OneDrive Management
OneDrive: A Microsoft file hosting and synchronization service.Management: The act or process of organizing, handling, directing or controlling something.
1,144 questions
0 comments No comments
{count} votes

Accepted answer
  1. MayankBargali-MSFT 69,416 Reputation points

    Hi @Jun Ting Ho

    The error is expected behavior as I see that you are using the source URL as Path of Get file metadata that returns BlobMetaData that has the Path which is The path of the file or folder of the onedrive.

    As you can see that the Path returns the right value in your case i.e. sL4ALP-file.txt but the Copy File accepts its as Source URL which is incorrect as the file name is passed. The copy File action needs the publicly accessible URL or the file share that you have configured so it can get the content and write the content to your destination path specified. I don't see any option to get the direct downloaded URL for the onedrive file that you can pass to the Copy File action. We do have the Create Share link connector that have SharingLink as output but your onedrive/organization should allow the publicly access URL. Once you have shared link then you can offload the functionality to azure function/your own logic to get the direct link and pass it to your Copy File action.

    Alternative as you are using Get File Content action you can pass the output to Create file action of azure file. Please review the limitation of the connectors.

    Feel free to get back to me if you have any queries or concerns.

0 additional answers

Sort by: Most helpful