Search code examples
azureazure-active-directorymicrosoft-graph-apiazure-app-registration

AADSTS700016: Application with identifier 'XXX' was not found in the directory 'directory_name'


Our application is up and running, but suddenly we encountered an issue when viewing documents from OneDrive through our application. We are receiving the following error:

"Application with identifier 'xxxxxxxx' was not found in the directory 'directory_name'. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You may have sent your authentication request to the wrong tenant."

Also, we have cross-checked clientId, tenant, and secret, where we have registered the application.

Any ideas on what could go wrong?

Here is the API permission:

enter image description here

Here is the code snippet:

enter image description here

in the highlighted line we are getting an "unauthorized client" error with the details: "AADSTS700016: Application with identifier '31359c7f-xxx-xxx-xxx-xxxx' was not found in the directory 'directory_name'. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You may have sent your authentication request to the wrong tenant."


Solution

  • Microsoft removed the built-in multi-tenant PnP Management Shell Entra App on September 9, 2024. As a result, you now need to register your own app in Entra to use PnP PowerShell.

    The error message you might see is: AADSTS700016: Application with identifier 'XXX' was not found in the directory.

    Unfortunately, Microsoft hasn’t yet notified admins via MessageCenter, and this change impacts all code and existing scripts. To get back on track, register an app in Entra ID for PnP PowerShell.

    Source: https://www.reddit.com/r/sysadmin/comments/1fe9af9/microsofts_latest_surprise_entra_id_app/