How to fix AADSTS700016 Application with identifier 'App Id' was not found in the directory 'Bot Framework'.

Amarpreet Kalkat 0 Reputation points
2025-08-06T15:02:28.02+00:00

I’m developing a Microsoft Teams bot using Bot Framework SDK v4 (Node.js), configured as a single-tenant Azure AD app. When testing in Teams, authentication fails with error AADSTS700016. Even a very simple “help” command that should return a plain text string fails to send a response in Teams.


Error:

vbnet
Copy
ServerError: unauthorized_client: Error(s): 700016
Description: AADSTS700016: Application with identifier '<APP_ID>' was not found in the directory 'Bot Framework'.
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.

Configuration Details (Sanitized):

Bot Framework SDK: v4.21.1 (Node.js)

App Type: Single-tenant

App ID: (hidden)

Tenant ID: (hidden)

Messaging endpoint: http://localhost:3978/api/messages

Channel service: https://smba.trafficmanager.net/amer/

Redirect URI in App Registration: https://token.botframework.com/.auth/web/redirect


What I’ve Done So Far:

Created Azure Bot resource, linked to App Registration.

Added correct redirect URI and API permissions.

Configured environment variables:

bash
Copy
MICROSOFT_APP_TYPE=SingleTenant
MICROSOFT_APP_ID=<APP_ID>
MICROSOFT_APP_PASSWORD=<APP_PASSWORD>
MICROSOFT_APP_TENANT_ID=<TENANT_ID>
MICROSOFT_APP_CHANNEL_SERVICE=https://smba.trafficmanager.net/amer/

Tried forcing the tenant ID explicitly in the adapter:

javascript
Copy
if (appType === 'SingleTenant' && tenantId) {
    const credentials = new MicrosoftAppCredentials(appId, appPassword, tenantId);
    adapter.credentials = credentials;
}

Verified token acquisition manually — works fine.

Added OAuth connection in Azure Bot resource.


Minimal Repro Case (Help Command): Even without OAuth calls, a basic command fails to deliver messages in Teams:

javascript
Copy
this.onMessage(async (context, next) => {
    const text = context.activity.text?.trim().toLowerCase();
    if (text === 'help') {
        await context.sendActivity('This is the help text.');
    }
    await next();
});

Expected: Bot responds with “This is the help text.” in Teams. Actual: Nothing appears; bot errors out with AADSTS700016.


Current Behavior:

Works fine locally without authentication.

Any Teams message triggers authentication attempt → fails with AADSTS700016.

Even static text replies cannot be sent unless authentication succeeds.


Questions:

How do I configure a single-tenant bot so Bot Framework Adapter uses my Azure AD tenant?

Are extra steps required for SingleTenant in Bot Framework v4?

Is AADSTS700016 a known issue for bots that don’t need multi-tenant support?

Are my channel service URLs correct for the AMER region?


Goal: Get the bot to respond in Teams (even with plain text messages) and authenticate correctly in both Emulator and Teams using our single-tenant Azure AD app.


Tags for Community Post:

Copy
azure-bot-service botframework microsoft-teams azure-active-directory
Azure AI Bot Service
Azure AI Bot Service
An Azure service that provides an integrated environment for bot development.
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.