Azure Stack Error ‘AADSTS90002′ and “AADSTS65001’

While you are working with Azure Stack, you may have seen the following two common error.

The first one:
{‘error’: ‘invalid_request’, ‘error_description’: ‘AADSTS90002: Tenant [tenant id] not found. This may happen if there are no active subscriptions for the tenant. Check with your subscription administrator.rnTrace ID: […]rnCorrelation ID: […]rnTimestamp: 2017-12-06 01:34:21Z’, ‘error_codes’: [90002], ‘timestamp’: ‘2017-12-06 01:34:21Z’, ‘trace_id’: ‘[…]’, ‘correlation_id’: ‘[…]’}

To resolve this error, you need to make sure the directory id is correct. Directory Id is used for getting access token from Microsoft. The id should place after the https://login.microsoftonline.com/

To find your directory:

Login to Microsoft Azure > Azure Active Directory > Properties > Directory ID

The error should disappear once you have placed the correct directory id.

The second one:
{‘error’: ‘invalid_grant’, ‘error_description’: “AADSTS65001: The user or administrator has not consented to use the application with ID ‘[app_id]’ named ‘[app_name]’. Send an interactive authorization request for this user and resource.rnTrace ID: […]rnCorrelation ID: […]rnTimestamp: 2017-12-06 01:36:37Z”, ‘error_codes’: [65001], ‘timestamp’: ‘2017-12-06 01:36:37Z’, ‘trace_id’: ‘[…]’, ‘correlation_id’: ‘[…]’}

This error means you have not been given the right access to your application from Azure AD. You have to login to your Azure account and register the app under Azure AD. Give the right permission and don’t forgot to grant the permission by applying the change.