Share via

Error when I try use Self Configured Virtual Agent Servicenow in Teams

Alessandra Ramos de Oliveira 0 Reputation points
2026-03-25T16:13:56.12+00:00

When trying to connect with the new auto-configured bot in Teams Web or Teams Desktop, I receive the message "There's a problem," and in the developer tools, I receive the following message:

{"errorCode":"InvalidUserId","errorCodeMessage":"Incorrect bot configuration/registration. Check the bot settings.","status":400}

However, I have checked the Client Secret, Client ID, and Tenant ID, and they are correct.

Microsoft Teams | Development
Microsoft Teams | Development

Building, integrating, or customizing apps and workflows within Microsoft Teams using developer tools and APIs

0 comments No comments

2 answers

Sort by: Most helpful
  1. Vergil-V 11,650 Reputation points Microsoft External Staff Moderator
    2026-03-26T00:56:06.8366667+00:00

    Hi @Alessandra Ramos de Oliveira   

    Based on my research, this situation most likely relates to a bot type mismatch between ServiceNow and the bot created in dev.teams.microsoft.com. 

    To work correctly, both configurations should be set under the Single tenant category, as described in Integrate your self-configured bot with single Microsoft Teams tenant • Australia Conversational In… 

    undefined

    This information is provided as a convenience to you. These sites are not controlled by Microsoft, and Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please ensure that you fully understand the risks before using any suggestions from the above link. 

     

    With that said, you may want to perform a quick sanity check in Microsoft Entra Admin > App Registrations > Selecting your bot > Authentication (preview) > Supported accounts  

     User's image

    It would also be helpful to verify the corresponding configuration within the ServiceNow portals to ensure consistency. 

    I hope this provides helpful insight and points you in the right direction. If you have any updates or additional findings, please feel free to share them. 


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Q&A Assist
    2026-03-25T16:14:13.15+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The error "errorCode":"InvalidUserId" with the message "Incorrect bot configuration/registration. Check the bot settings." indicates a bot registration/configuration problem in Microsoft Entra ID / Azure Bot, not an issue with the client secret, client ID, or tenant ID alone.

    From similar Teams bot issues, this typically occurs when:

    1. The Azure Bot resource and the Entra app registration are not aligned (for example, one is single‑tenant and the other is multi‑tenant, or they are not correctly linked).
    2. The bot adapter / CloudAdapter is initialized incorrectly for the tenant or cross‑tenant scenario.
    3. The Service Principal for the app registration is missing in the tenant where Teams is running.

    Use the following checks and fixes:

    1. Align bot and app registration tenancy
      Ensure the Azure Bot resource and the corresponding Microsoft Entra app registration use the same tenant model:
      • If the bot is configured as SingleTenant in Azure Bot Service (msaAppType: 'SingleTenant'), the app registration should also be single‑tenant, and the bot should be used only in that tenant.
      • If cross‑tenant use is required, ensure the adapter and auth configuration explicitly handle the target tenant; misalignment here is a common cause of 400/Unauthorized/InvalidUserId errors.
    2. Verify Service Principal exists in the tenant
      If the bot is used in a tenant where the Service Principal for the app registration does not yet exist, token acquisition and identity resolution can fail:
      1. In the Azure portal, go to App registrations and open the app registration used by the bot.
      2. Check the Managed application in local directory field.
      3. If no Service Principal exists, select Create Service Principal.
      4. After creation, restart the bot and test again in Teams.
    3. Review adapter / CloudAdapter initialization
      In the bot code, ensure the adapter is initialized according to the latest SDK guidance (especially for cross‑tenant or multi‑tenant scenarios). Incorrect initialization of the adapter for cross‑tenant communication is known to cause authorization/identity errors when sending or receiving activities. Updating the adapter configuration to match current samples (including correct tenant handling) has resolved similar issues.
    4. Confirm OAuth connection and token configuration (if using SSO)
      If the bot uses SSO or OAuth:
      • Verify the OAuth connection in the Azure Bot resource has the correct client ID, client secret, tenant ID, and scopes.
      • Use Test connection in the bot resource to confirm the OAuth connection succeeds.
        Misconfigured OAuth/SSO can surface as invalid user or auth errors when Teams tries to obtain a token for the user.

    If, after these steps, the error persists, re‑create the bot registration and app registration in a clean, single‑tenant configuration, validate that Teams can send and receive messages successfully, and then re‑introduce any cross‑tenant or advanced auth configuration incrementally.


    References:

Your answer

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