A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
Hello Dinakar,
Welcome to Microsoft Q&A and Thank you for reaching out.
I understand that you're having some trouble with your Teams bot, specifically with 1:1 chats throwing an exception.
This strongly suggests a scope-specific invocation or authorization issue, rather than a general Foundry or Teams bot failure.
What’s Happening
Difference in Invocation Context
Teams routes activities differently depending on scope.
Channel context Includes team and channel identifiers
App is installed at team level
Strong tenant + team context available
Tool execution often inherits team-installed permissions
Personal (1:1) context:
No teamId or channelId
Different activity payload
Different token claims
May lack team-scoped permissions
If your tool assumes the presence of:
teamId
channelId
Team-level Graph permissions
Team-installed app state
it will work in channel scope but fail in personal scope.
This can trigger AgentsV2InvocationUserException during tool invocation.
Tool Execution Authorization Differences
Since the error only appears when tools are attached, the failure is likely happening during:
Tool authorization
Identity resolution
On-behalf-of (OBO) token flow
Downstream API call execution
In personal scope:
User consent may be required separately
Delegated permissions may not be granted
Resource-Specific Consent (RSC) may not apply
If your tool calls:
Microsoft Graph
SharePoint
Teams APIs
Custom secured APIs
verify that delegated permissions and consent apply to personal scope as well.
Managed Identity (MI) Considerations
You mentioned the bot worked after assigning the correct Managed Identity.
Please verify The Managed Identity has required role assignments, Any downstream API permissions apply outside team scope, The tool does not depend on team-level RBAC
Sometimes MI works in channel scope because resources are team-bound, but fails in personal scope due to missing context.
Teams App Manifest Configuration
Confirm your Teams app manifest includes:
"bots": [
Also verify webApplicationInfo is correctly configured (if using SSO)
Proper AAD app ID is referenced
Required Graph delegated permissions are granted
Admin consent is completed
Tool Code Assuming Team Context
A very common issue:
Tool logic assumes:
context.teamId exists
context.channelId exists
In 1:1 chat, those values are null.
If your tool execution pipeline attempts to access team-specific resources without null handling, it will throw during invocation.
You should explicitly handle scope differences:
- If team context exists → execute team logic
- If personal scope → execute user-scoped logic
Logging & Diagnostics
Enable detailed logging (Application Insights recommended) and compare:
Working channel invocation vs failing personal invocation.
Log:
Incoming activity payload
Claims principal
Tenant ID
Conversation ID
Tool execution stage
Token acquisition result
You will likely observe missing claims or failed token acquisition in personal scope.
Is This Expected Behavior?
No, agents should work in both scopes.
However, tools that depend on:
Team context
Team-installed permissions
RSC
Delegated Graph access without proper consent
Improperly handled null team identifiers
can fail specifically in personal scope.
Recommended Troubleshooting Sequence
Confirm Teams app manifest includes "personal" scope
Verify delegated Graph/API permissions and admin consent
Compare activity payloads between channel and personal
Validate OBO flow works in personal scope
Check tool code for assumptions about team context
Review Managed Identity RBAC assignments
Enable detailed logging and inspect invocation pipeline.
Please refer this
- Understanding Differences in Azure OpenAI Model Deployments Behaviors
- General troubleshooting for Azure AI Bot Service bots
I Hope this helps. Do let me know if you have any further queries.
Thank you!