I'm having an issue with my copy data activity in the pipeline

Dima mohamed 0 Reputation points
2025-02-12T14:27:29.34+00:00

I am using Azure Data Factory (ADF) Copy Activity to retrieve a file from SharePoint Online following the setup in https://www.youtube.com/watch?v=FFfNu3cI-uw. However, I am encountering the following error:

Request URL: https://sharepoint.com/sites/documentation/_api/web/GetFileByServerRelativeUrl('/sites/documentation/Tech documentation/')/$value.,Source=Microsoft.DataTransfer.ClientLibrary,''Type=System.Net.WebException,Message=The remote server returned an error: (403) Forbidden.,Source=System,'

Please note i gave the app permission to access and the access token is valid. Its able to access sharepoint but basically unable to fetch the data.

User's image

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,266 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,233 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Chandra Boorla 8,470 Reputation points Microsoft Vendor
    2025-02-13T02:26:05.5366667+00:00

    @Dima mohamed

    Greetings & Welcome to Microsoft Q&A forum! Thanks for posting your query!

    The error message indicates that your Azure Data Factory Copy Activity is successfully authenticating with SharePoint Online but is encountering a 403 Forbidden error when trying to fetch the file.

    Understanding the Error

    403 Forbidden means that authentication was successful, but the authenticated user (or app) does not have the necessary permissions to access the requested resource. The request is targeting this endpoint:

    https://sharepoint.com/sites/documentation/_api/web/GetFileByServerRelativeUrl('/sites/documentation/Tech documentation/')/$value
    

    This is an API request to get a file from SharePoint using the GetFileByServerRelativeUrl method.

    Possible reasons for the issue are either:

    • Insufficient permissions on SharePoint for the ADF Managed Identity or Service Principal.
    • Incorrect file path (e.g., trying to access a folder instead of a file).

    Here are few considerations that might help you:

    Check if you are accessing a Folder instead of a File - The URL contains '/sites/documentation/Tech documentation/', which looks like a folder instead of a file. If you're trying to fetch a specific file, the URL should look like:

    /sites/documentation/Tech documentation/MyFile.xlsx
    

    Make sure you specify the exact file name with the correct extension.

    Test API Call in Postman or PowerShell - Try calling the API manually to verify access. If it fails, permissions or the path are incorrect.

    Check ADF Copy Activity Settings - Ensure you are using "ServerRelativeUrl" in the dataset configuration. Confirm the SharePoint URL format is correct. If accessing a file inside a folder, do not include the trailing slash (/) at the end of the file path.

    Please refer to MS Q&A thread - Copy File from SharePoint not working addressing similar issue.

    I hope this information helps. Please do let us know if you have any further queries.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.


Your answer

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