Azure Function App to Read SharePoint Site Collection Content

Ricker, Janette M 1 Reputation point
2022-06-15T21:14:23.067+00:00

I'm obviously missing a step somewhere and haven't a clue as to where. Any recommendations would be appreciated.

I have a SharePoint Online Site Collection on which I am a Site Collection Admin
I have an Azure App Service SPA app that requires me to login (same credentials used for this and SharePoint)
I have an Azure AppReg for the above App Service that is set to User.Read for MS Graph and user_delegate for the API below
I have an Azure Function App with C# code that uses AuthenticationManager and GetContextAsync to get ahold of the SharePoint site collection
I have an Azure AppReg for the above Function App that is set to User.Read for MS Graph and AllSites.Read delegated

I can login to the SharePoint site collection without issue
I can login to the Azure App Service SPA app without issue
The Azure Function App fails with the error "You do not have permission to view this directory or page." Which I obviously do.

We've confirmed AuthenticationManager is using the clientID and tenantID of the Function App's AppReg and the URL is the correct one for SharePoint.

Any thoughts will be gratefully accepted.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,957 questions
Azure App Configuration
Azure App Configuration
An Azure service that provides hosted, universal storage for Azure app configurations.
228 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,663 questions
{count} votes

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.