Deploying with Microsoft.Graph sdk to Azure Function App Isolated Worker Net 8.0 causing InternalServerError from host runtime

Alexander Giacobbe 0 Reputation points
2024-12-26T19:18:29.9333333+00:00

I am trying to debug this issue where the inclusion of the Microsoft.Graph SDK is causing the azure function app host run time to fail.

Running the function app in debug mode locally I have no issues using Microsoft Graph to access the data I need. It is only after deploying the app that I receive an error in Azure:
User's image User's image

I am using Azure Identity alongside Microsoft.Graph to access Sharepoint through ClientSecretCredentials. Only one class/project has these dependencies:

<PackageReference Include="Azure.Identity" Version="1.13.1" />
<PackageReference Include="Microsoft.Graph" Version="5.67.0" />

SharepointClient.cs

public class SharepointClient
{
    private GraphServiceClient _graphClient;

    public SharepointClient(string tenantId, string clientId, string clientSecret)
    {
         var clientSecretCredential = new ClientSecretCredential(tenantId, clientId, clientSecret);
         _graphClient = new GraphServiceClient(clientSecretCredential);
    }

    / * ... */
}

I am not using Dependency Injection yet, I have only installed the package and receive this error after deploying.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,256 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,661 questions
0 comments No comments
{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.