-
-
Save asith-w/c3166b7018363d94cf7807ae880b2319 to your computer and use it in GitHub Desktop.
github-issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override async Task ExecuteAsync(CancellationToken stoppingToken) | |
{ | |
var tenantIds = new List<string>{ | |
"1448f51b-234d-123345-86c8-0f6a634bbbb1", | |
"2448f51b-234d-123345-86c8-0f6a634bbbb2", | |
"3448f51b-234d-123345-86c8-0f6a634bbbb3", | |
"4448f51b-234d-123345-86c8-0f6a634bbbb4", | |
"5448f51b-234d-123345-86c8-0f6a634bbbb5" | |
}; | |
IConfidentialClientApplication confidentialClientApplication; | |
//1st requests | |
foreach (var tenantId in tenantIds) | |
{ | |
confidentialClientApplication = ConfidentialClientApplicationBuilder | |
.Create(_azureADConfiguration.ClientId) | |
.WithTenantId(tenantId) | |
.WithClientSecret(_azureADConfiguration.ClientSecret) | |
.Build(); | |
var clientCredentialProvider = new ClientCredentialProvider(confidentialClientApplication); | |
var graphServiceClient = new GraphServiceClient(clientCredentialProvider); | |
var users = await graphServiceClient.Users | |
.Request() | |
.GetAsync(); | |
} | |
//2st requests | |
foreach (var tenantId in tenantIds) | |
{ | |
confidentialClientApplication = ConfidentialClientApplicationBuilder | |
.Create(_azureADConfiguration.ClientId) | |
.WithTenantId(tenantId) | |
.WithClientSecret(_azureADConfiguration.ClientSecret) | |
.Build(); | |
var clientCredentialProvider = new ClientCredentialProvider(confidentialClientApplication); | |
var graphServiceClient = new GraphServiceClient(clientCredentialProvider); | |
var users = await graphServiceClient.Users | |
.Request() | |
.GetAsync(); | |
} | |
//two tokens are generated for each tenant. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment