401 Error when copying from Sharepoint using HTTP Linked Service

Rachel Stewart 1 Reputation point
2020-12-15T15:49:02.803+00:00

The error below is displayed when trying to copy a file from Sharepoint to Azure Blob storage using an ADF copy activity.
48318-image.png

I have followed this documentation https://learn.microsoft.com/en-us/azure/data-factory/connector-sharepoint-online-list#copy-file-from-sharepoint-online

My web activity is getting a bearer token and the output is saying one file is read.

I have followed the prerequisites in the above support article, including registering the application.

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

3 answers

Sort by: Most helpful
  1. Saurabh Sharma 23,676 Reputation points Microsoft Employee
    2020-12-16T01:04:12.61+00:00

    @Rachel Stewart Thanks for using Microsoft Q&A !!

    I have also followed the tutorial and able to use the token to copy file from SharePoint to a Blob storage.
    48562-image.png

    You may be getting this error if you have sent the request to get the token for a different resource endpoint in web activity. I have also faced similar error when put wrong address in resource=. Can you please make sure that resource url is correct ?

    grant_type=client_credentials&client_id=[Client-ID]@[Tenant-ID]&client_secret=[Client-Secret]&resource=00000003-0000-0ff1-ce00-000000000000/[Tenant-Name].sharepoint.com@[Tenant-ID]

    1 person found this answer helpful.

  2. Anusha Samineni 1 Reputation point
    2021-08-25T16:36:45.247+00:00

    Hi,

    Facing same error. Passed the url correctly as per msdn documentation or these threads. Still no luck. Any further advise? Also granted exactly same permissions listed on the copy file from sharepoint via ADF documentation.

    0 comments No comments

  3. Dimitri Bütikofer 1 Reputation point
    2022-10-27T09:12:29.143+00:00

    Hi @Rachel Stewart

    A few weeks ago I ran into the same problem following the same documentation and couldn't find an answer anywhere.

    I was able to solve the problem by enabling Custom App Authentication. For SPO tenants that were created after 07.11.2018 the authentication via ACS app-only access token is disabled by default (see screenshot and link).

    254599-msft.png
    security-apponly-azureacs

    I decided to write a blog post with a step by step guide on how to move multiple files from an SPO folder to Blob Storage using Azure Data Factory, maybe you will find it useful:
    copy-files-from-sharepoint-to-blob-storage-using-azure-data-factory

    0 comments No comments