- Первый экземпляр указывает к приложению клиента Azure AD B2C.
- Второй экземпляр указывает на приложение Azure Entra ID, которое используется для отправки электронных писем через Graph API, поскольку каталог по умолчанию — это тот, который имеет MS Лицензия 365.
{
var config = serviceProvider.GetRequiredService();
var azureAdB2CConfiguration = config.GetSection("AzureAdB2C"); // for B2C tenant
var clientSecretCredential = new ClientSecretCredential(
azureAdB2CConfiguration.GetValue("Domain"),
azureAdB2CConfiguration.GetValue("ClientId"),
azureAdB2CConfiguration.GetValue("ClientSecret")
);
return new GraphServiceClient(clientSecretCredential, ["https://graph.microsoft.com/.default"]);
});
services.AddSingleton(static serviceProvider =>
{
var config = serviceProvider.GetRequiredService();
var azureAdB2CConfiguration = config.GetSection("EntraId"); // for Entra ID
var clientSecretCredential = new ClientSecretCredential(
azureAdB2CConfiguration.GetValue("Domain"),
azureAdB2CConfiguration.GetValue("ClientId"),
azureAdB2CConfiguration.GetValue("ClientSecret")
);
return new GraphServiceClient(clientSecretCredential, ["https://graph.microsoft.com/.default"]);
});
Подробнее здесь: https://stackoverflow.com/questions/793 ... onfigurati
Мобильная версия