Teams error 401 Unauthorized (invalid app ID / password): Invalid Microsoft App ID or password
Last verified against Microsoft Learn - Status codes from bot conversational APIs
AADSTS7000215: Invalid client secret provided.What error 401 Unauthorized (invalid app ID / password) means
Your bot could not exchange its credentials for an access token, so every outbound Connector call - and, on the inbound side, every attempt to validate that requests really come from the Bot Framework - fails with 401. The failure lives in the appId / password / tenant triangle: the Microsoft App ID (a Microsoft Entra application), the client secret issued for that application, and the tenant the token request is sent to. All three must agree. A perfectly valid secret paired with the wrong app ID fails; a valid pair sent to the wrong tenant endpoint fails; and each corner fails with a different AADSTS code in the token response body.
The two you will actually see: AADSTS7000215, which the Microsoft Entra error reference describes as "Invalid client secret is provided" - very often because the secret ID column was copied from the portal instead of the secret value, which is only shown once at creation - and AADSTS700016, "The application wasn't found in the directory/tenant", which means the app ID itself is wrong for the tenant you are authenticating against (see the tenant mismatch entry when the ID is right but the tenant is not).
Because the token exchange happens before Teams is involved, the user-visible symptom is pure silence: messages send, the bot never replies, and nothing appears in Teams itself. Your service logs show the 401 either at adapter startup or on the first reply attempt.
What it looks like
{
"error": "invalid_client",
"error_description": "AADSTS7000215: Invalid client secret provided. ...",
"error_codes": [7000215],
"timestamp": "2026-08-20 09:14:02Z"
}Why it happens
- The client secret ID (a GUID) was pasted into configuration instead of the secret value, which Azure shows only once at creation time.
- The secret value was regenerated in Entra and the deployment still carries the old one.
- MicrosoftAppId belongs to a different app registration (staging vs production) than the secret does.
- Hidden whitespace, quotes, or a trailing newline wrapped around the secret in an environment variable or Key Vault entry.
- The secret has expired - see the dedicated 401 expired client secret entry.
How to fix Teams error 401 Unauthorized (invalid app ID / password)
- 1Reproduce the failure outside your code with the documented cURL check: POST to https://login.microsoftonline.com/botframework.com/oauth2/v2.0/token with grant_type=client_credentials, your client_id, client_secret, and scope=https%3A%2F%2Fapi.botframework.com%2F.default.
- 2If the response is AADSTS7000215, create a new client secret in Entra (App registrations > Certificates & secrets), copy the value column immediately, and redeploy.
- 3If the response is AADSTS700016, the app ID is wrong or in another tenant: copy the Application (client) ID from the app registration's Overview blade and compare.
- 4Print repr() of both values at startup in a debug build to expose stray whitespace or quotes.
- 5When the cURL check returns an access_token, restart the bot and confirm the first reply succeeds; if Teams still fails, work through the 401 BotNotRegistered entry next.
How to stop it recurring
Store the secret in a secrets manager and validate credentials at startup by requesting one token, failing the deploy loudly on 401 instead of shipping a bot that cannot speak. Record which app ID each environment uses next to the secret so the triangle can be audited in one place. The token cURL test in the fix list is cheap enough to run in CI on every release; Microsoft's own troubleshooting guide makes it step 2 of four. Silent credential drift is cause 2 in Teams bot not responding.
Official reference: Microsoft Learn - Status codes from bot conversational APIs. See all Teams error codes or the Teams limits and quotas.
Related codes
- 401 Unauthorized (expired client secret): Expired client secretAADSTS7000222: The provided client secret keys are expired.
- 401 Unauthorized (tenant mismatch): Single-tenant vs multi-tenant mismatchAADSTS700016: The application wasn't found in the directory/tenant.
- 401 Unauthorized (token audience): Wrong token scope or audienceAuthorization has been denied for this request.
- 401 BotNotRegistered: BotNotRegistered - no registration foundNo registration found for this agent.
Error 401 Unauthorized (invalid app ID / password) - quick answers
What does Teams error 401 Unauthorized (invalid app ID / password) mean?
Your bot could not exchange its credentials for an access token, so every outbound Connector call - and, on the inbound side, every attempt to validate that requests really come from the Bot Framework - fails with 401.
How do I fix Teams error 401 Unauthorized (invalid app ID / password)?
1. Reproduce the failure outside your code with the documented cURL check: POST to https://login.microsoftonline.com/botframework.com/oauth2/v2.0/token with grant_type=client_credentials, your client_id, client_secret, and scope=https%3A%2F%2Fapi.botframework.com%2F.default. 2. If the response is AADSTS7000215, create a new client secret in Entra (App registrations > Certificates & secrets), copy the value column immediately, and redeploy. 3. If the response is…
Stop debugging Teams by hand
Connect the channel through Conferbot: tokens, webhooks and retries are handled, failures show as readable status.