I am migrating and older app to .net 7 and updating the libraries along the way. I am having one heck of a time figuring out the changes to MSGraph v5.
Googling I found a number of suggestions that I have not been able to work. In my Startup.cs file, I have this:
using Microsoft.Graph;
using Microsoft.Identity.Client;
public static class GraphConfiguration
{
public static IServiceCollection ConfigureGraphComponent(
this IServiceCollection services,
IConfiguration configuration
)
{
var graphConfig = configuration.GetSection("AzureAD");
var confidentialClientApplication = ConfidentialClientApplicationBuilder
.Create(graphConfig["ClientId"])
.WithTenantId(graphConfig["Tenant"])
.WithClientSecret(graphConfig["ClientSecret"])
.Build();
var authenticationProvider = new ??????(confidentialClientApplication);
// Use a single client instance for the lifetime of the application
services.AddSingleton(sp => new GraphServiceClient(authenticationProvider));
return services;
}
}
I gave the Delegate auth provide a try but it seems like it is no longer avaiable. Any idea which Auth provider I can use? In the code above, I am looking to fix the following line:
var authenticationProvider = new ??????(confidentialClientApplication);
Thanks, E.
I'm using
ClientSecretCredential
class fromAzure.Identity
NuGet.