Access Azure AD Graph API in ASP.NET MVC Organizational Account

I am trying to restrict access to a page based on user groups registered in AD. I have problems with the following codes.

   var tenantId = incomingPrincipal.FindFirst(GraphConfiguration.TenantIdClaimType).Value;

 //create Azure Graph Api client to make api calls
 var client = Helpers.AzureGraphAPIFunctions.GetActiveDirectoryClient(tenantId);

 IGroup group = client.Groups.Where(x => x.DisplayName == groupName).ExecuteSingleAsync().Result;

These codes work fine and get me AD Group by groupName, but sometimes throw an exception

"Tenant information is not available locally. Use the following URLs to get information."

{"odata.error":{"code":"Directory_BindingRedirection","message":{"lang":"en","value":"Tenant information is not available locally. Use the following Urls to get the information."},
"values":[
          {"item":"Url1","value":"https:\/\/directory-s1-ch1.directory.windows.net"},
          {"item":"Url2","value":"https:\/\/directory-s1-sn2.directory.windows.net"},
          {"item":"Url3","value":"https:\/\/directory-s1-co1.directory.windows.net"},
          {"item":"Url4","value":"https:\/\/directory-s1-bl2.directory.windows.net"}
         ]}}

Any ideas?

thank

+4
source share
1 answer

People,

We are currently investigating this problem (you should not see this error). It looks like a regression. This thread will be updated when I have more information.

UPDATE:
. , /. , ( ).

, .

+3

Source: https://habr.com/ru/post/1599492/


All Articles