Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AADSTS90002: Tenant 'xx' not found. This may happen if there are no active subscriptions for the tenant

I followed this tutorial to generate an access token from client app for target app. According to the comment for this tutorial, for the resources, I changed to App ID URL. But I am still not able to successfully generate bearer token for the target app.

It shows this error message:

AdalException: {"error":"invalid_request","error_description":"AADSTS90002: Tenant '' not found. This may happen if there are no active subscriptions for the tenant....}

Anyone knows what else I missed?

like image 852
superninja Avatar asked Dec 05 '22 10:12

superninja


2 Answers

For me the issue was resolved by using older version of Microsoft.IdentityModel.Clients.ActiveDirectory. I had to used 3.13.8 version. Latest version has issues.

like image 62
Sajal Mittal Avatar answered Jan 05 '23 01:01

Sajal Mittal


Using ADAL to get access token using client credential flow :

AuthenticationContext authenticationContext =
       new AuthenticationContext("https://login.microsoftonline.com/<tenantId>");

ClientCredential clientCredential = new ClientCredential(clientId, appKey);
AuthenticationResult result =
       await authenticationContext.AcquireTokenAsync("https://resourceUrl",
                                                         clientCredential);

Reference : https://github.com/AzureAD/azure-activedirectory-library-for-dotnet/wiki/Client-credential-flows

And document : Service to service calls using client credentials

like image 43
Nan Yu Avatar answered Jan 05 '23 01:01

Nan Yu