Error Encountered: OrganizationFromTenantGuidNotFound
We are encountering an error related to Microsoft Graph API integration in our Django application. Specifically, the error message is:
{
"error": {
"code": "OrganizationFromTenantGuidNotFound",
"message": "The tenant for tenant guid 'e01c8511-af06-4cad-9b24-a63b9da7b0fc' does not exist.",
"innerError": {
"oAuthEventOperationId": "8b058e01-f527-4afe-9294-ee28aec98e19",
"oAuthEventcV": "D3A3Bd+uExjl4MwXmDgIqw.1.1",
"errorUrl": "https://aka.ms/autherrors#error-InvalidTenant",
"requestId": "fda9cb55-b436-4590-b3b3-3d847ee7e931",
"date": "2024-09-16T18:42:41"
}
}
}
This happens when trying to authenticate using Azure AD and fetch emails via Microsoft Graph API. The decoded token shows a valid tenant_id, client_id, and permissions, but we suspect there might be an issue with the tenant configuration or app registration on Azure.
At the moment, using the token, I can get a list of all users. However, when I go to the information on a specific user, an error occurs. However, on the application side, no errors are displayed. My main task is to configure the functionality of sending messages from my application, so that messages sent to the user’s address are visible in the application (also when sending a message to a user).
https://graph.microsoft.com/v1.0/users/
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users",
"value": [
{
"businessPhones": [],
"displayName": "Demo Mail",
"givenName": null,
"jobTitle": null,
"mail": "[email protected],
"mobilePhone": null,
"officeLocation": null,
"preferredLanguage": null,
"surname": null,
"userPrincipalName": "---",
"id": "d028f0d4-0838-4925-8eeb-5f6651b6cfb1"
},
]
}
https://graph.microsoft.com/v1.0/users/[email protected]
{
“error”: {
“code”: “Request_ResourceNotFound”,
“message”: “Resource ‘[email protected]’ does not exist or one of its queried reference-property objects are not present.”,
“innerError”: {
“date”: “2024-09-16T18:52:55”,
“request-id”: “0a7e7545-598b-42d6-8d0f-afbac98f26d0”,
“client-request-id”: “0a7e7545-598b-42d6-8d0f-afbac98f26d0”
}
}
}
We’ve ensured that:
The tenant ID is correctly set in our Django settings.
The app is registered in Azure AD with the correct permissions, including Mail.Read and Mail.ReadWrite.
Admin consent has been granted for all required permissions.
2