data factory sharepoint data copy issue

Sharad Ghallal 0 Reputation points
2025-02-28T08:31:06.52+00:00

We are trying to copy files from a SharePoint Online location to an ADLS container. We have provided the appropriate permissions for both the ADF App and the SharePoint App in Active Directory. Additionally, we have registered the Application ID in SharePoint. However, we are encountering a 401 Unauthorized error. Please help us resolve this issue.

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,301 questions
{count} votes

2 answers

Sort by: Most helpful
  1. J N S S Kasyap 670 Reputation points Microsoft External Staff
    2025-02-28T10:13:57.4+00:00

    Hi @Sharad Ghallal
    Thank you for posting your query!

    We understand that you are encountering a 401 Unauthorized error while copying files from SharePoint Online to an ADLS container using Azure Data Factory (ADF), which is likely due to authentication or permission settings.

    Here are a few key areas to check and resolve the issue:

    Ensure that the Application ID used in ADF is properly registered in SharePoint Online and that the necessary API permissions are granted, including Sites.Read.All or Sites.FullControl.All for site access and Files.ReadWrite.All for file operations. After making any changes, make sure to grant admin consent in Azure AD to apply the permissions successfully.

    If your using Service Principal Authentication, ensure that the correct Client ID, Client Secret, and Tenant ID are configured in the ADF Linked Service for SharePoint.

    For App-Only Authentication, ensure that the App Identifier (Client ID & Secret) is added to SharePoint’s AppInv.aspx and granted the appropriate site permissions.

    Ensure that Conditional Access policies, IP restrictions, or MFA are not blocking authentication and that the ADF service principal is exempted if necessary.

    Please refer to the Microsoft documentation below, as it will help you resolve the issue.
    https://learn.microsoft.com/en-us/answers/questions/999634/copy-files-from-sharepoint-to-azure-datalake-using
    https://learn.microsoft.com/en-us/azure/data-factory/connector-sharepoint-online-list?tabs=data-factory
    Please let us know if you need additional guidance, and we are happy to assist.


    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.


  2. Sharad Ghallal 0 Reputation points
    2025-03-04T07:59:04.2466667+00:00

    Hi Kasyap,
    I followed each and every point mentioned in above guideline but still I am getting the 401 Unauthorized error.
    Can you please forward any video to follow the above guidelines so that we can check any point we are missing out.

    error - ErrorCode=HttpRequestFailedWithUnauthorizedError,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=Http request failed with status code 401 Unauthorized, usually this is caused by invalid credentials, please check your activity settings.,Source=Microsoft.DataTransfer.ClientLibrary,''Type=System.Net.WebException,Message=The remote server returned an error: (401) Unauthorized.,Source=System,'
    User's image

    Thanks!


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.