How do I connect a custom GPT to our SharePoint site/library/folder?

Jason Reed 0 Reputation points
2025-05-16T12:30:39.66+00:00

We're trying to connect a custom GPT to a specific folder within SharePoint. Our instructions included setting up an Azure AD App along with a an Azure Function. I've been working with our IT department to assist with setting up the Azure AD App since I don't have permission to do so. I was able to set up the Function App. We've loaded code into the Function App, used the proper client ID, client secret and Tenant ID to set up Oauth inside of the GPT, but are still getting errors. According to the chat I've been having with the llm, the problem is that "the Custom GPT is issuing a user token that isn't signed by your Azure AD App Registration, so Microsoft rejects it during the On-Behalf-Of (OBO) token exchange with a signature validation error."

I don't know if that is the problem, but if anyone has had success with this, please help in any way you can as we want to be able to scale this type of process throughout our organization.

Thank you!

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,911 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Ranashekar Guda 2,820 Reputation points Microsoft External Staff Moderator
    2025-05-19T21:11:03.34+00:00

    Hello @Jason Reed,
    To connect a custom GPT to a specific folder in SharePoint, you need to make sure your Azure AD App is correctly set up to handle authentication and access permissions. First, ensure the app is registered in Azure AD and has the necessary Microsoft Graph API permissions, such as Sites.Selected, to access SharePoint content.

    The error you’re facing may be due to an invalid token, which often happens when it’s not issued by the correct app or isn’t properly configured. Double-check that the client ID, client secret, and tenant ID are correctly set and that your OAuth flow is working as expected. If you're using the On-Behalf-Of (OBO) flow, make sure the original user token is valid and includes the right scopes for SharePoint access.

    Also, confirm that all required permissions have been granted and consented to by an administrator in your Azure AD tenant this step is often missed. Sometimes, even if permissions are set, they need to be explicitly granted consent for the application to function correctly.

    For troubleshooting, you can use tools like Microsoft Graph Explorer to test API calls and verify if the issue lies with token generation or missing permissions.

    Kindly refer below links:
    Create a SharePoint connection
    SharePoint Server Microsoft Graph connector
    Use the Microsoft Graph API
    Hope this helps. Do let us know if you any further queries.


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.