ADF Access to sharepoint to access csv files. Setup of Linked services

Krishnamohan Nadimpalli 406 Reputation points
2022-07-29T08:21:53.553+00:00

Hi

I am trying to connect from ADF to Sharepoint while creating Linked services, but it shows error "Failed to get metadata of odata service, please check if service url and credential is correct and your application has permission to the resource. Expected status code: 200, actual status code: Unauthorized, response is : {"error_description":"Exception of type 'Microsoft.IdentityModel.Tokens.AudienceUriValidationFailedException' was thrown."}.
Activity ID: 94cdd116-08f1-4e23-ba56-7fc430c29b58."

I used the below documentation
https://learn.microsoft.com/en-us/azure/data-factory/connector-sharepoint-online-list?tabs=data-factory#prerequisites

Sharepoint permissions given by sharepoint admin.Below is screenshot

226094-image.png

My adf settings are below
226067-image.png

error screenshot attached . Please advise

226025-ss.png

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

1 answer

Sort by: Most helpful
  1. KranthiPakala-MSFT 46,642 Reputation points Microsoft Employee Moderator
    2022-08-01T19:00:42.237+00:00

    Hello @Krishnamohan Nadimpalli ,

    Thanks for the question and using MS Q&A platform.

    From the error message Please check if service url and credential is correct and your application has permission to the resource. Expected status code: 200, actual status code: Unauthorized - Seems like you are having authentication issue to your SharePoint site.

    Please make sure you follow the exact steps as described below:

    Register SharePoint Application and Grant permission

    • Register AAD Application (with user's personnel account) a) Open azure portal aad app registration page: https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps
      b) New registration, enter your app name
      c) Go to Certificates & secrets, create new client secret, you can set the expire to 1Y/2Y/Never
      226867-image.png
    • Grant sharepoint site permission to your registered App (need site owner permission) 1) How to find the site owner
      a) Go to site home page( e.g. https://[your_site_url]/_layouts/15/appinv.aspx (replace the site URL)), and click the X members in the right corner
      226868-image.png b) Check who is the owner 226898-image.png 2)Open sharepoint site link: https://[Tenant-Name].sharepoint.com/sites/[Site-Name]/_layouts/15/appinv.aspx (replace tenant/site name) 3)Search the AppId you just registered in Step 1a and fill the empty fields and click "Create"
      App Domain: localhost.com
      Redirect URL: https://www.localhost.com
      Permission Request XML:
    <AppPermissionRequests AllowAppOnlyPolicy="true">  
       <AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web" Right="Read"/>  
    </AppPermissionRequests>  
    

    226903-image.png

    4) Click "Trust It" for this app

    Then create ADF pipeline with the flow discussed in the document: Copy file from SharePoint Online

    226836-image.png

    Hope this info helps. Do let us know how it goes.


    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators

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.