Home / Blog / Microsoft 365 & Copilot
Teams Bots with Azure Bot Service: Architecture and Best Practices
By Softworth Solutions · · 4 min read · For readers in UK, US, UAE, India

In short: A Teams bot has three parts: an Azure Bot resource that gives it an identity and connects it to Teams, a web service that runs your bot logic, and a Teams app package that tells Teams what the bot can do. Production readiness comes from getting identity, long-running work, state and monitoring right.
Getting a hello-world bot talking in Teams takes an afternoon. Getting one that is secure, quick, sends notifications reliably and survives real users takes deliberate design. Here is the architecture we use and the practices that matter most.
What does a Teams bot architecture look like?
A message travels from the Teams client through Microsoft's Bot Connector to your HTTPS messaging endpoint. Your code handles it and replies along the same path. Around that core sit a few supporting pieces.
| Component | Typical choice | Purpose |
|---|---|---|
| Azure Bot resource | Single-tenant or managed identity | Bot identity and Teams channel |
| Bot host | App Service, Container Apps or Functions | Runs your bot logic |
| SDK | Bot Framework SDK, Teams AI library or Microsoft 365 Agents SDK | Handles activities and cards |
| State store | Cosmos DB or Table Storage | Conversation references and user state |
| Monitoring | Application Insights | Logs, traces and failures |
If you are still deciding between bots, tabs and message extensions, start with our explainer on building Microsoft Teams apps.
How should authentication work?
Keep two identities separate in your head. The bot's identity proves to Teams that messages really come from your bot. For internal bots, use single-tenant registration or a user-assigned managed identity, which removes client secrets entirely. Only bots distributed to other organisations need multi-tenant set-up, and Microsoft's guidance there has been changing, so check the current docs.
The user's identity matters when the bot calls Graph or your own APIs on their behalf. Configure single sign-on with an OAuth connection on the bot resource, request only the scopes you need and always validate tokens on the server. Our post on Entra ID single sign-on for app developers covers the details.
How do you handle slow work and notifications?
Acknowledge fast and finish later. Teams expects a quick response, but a model call with retrieval or a slow ERP query can take much longer. Reply with a typing indicator or holding message, push the job to a queue such as Azure Service Bus, and let a worker post the result proactively.
Proactive messages need a stored conversation reference for each user or channel, captured on install. Lose those and your bot can never start a conversation, which rules out the alert, approval and daily-summary bots that tend to deliver the most value.

An illustrative example
Consider a Manchester-based facilities firm whose site managers approve purchase requests by email, slowly. A Teams bot posts each request as an Adaptive Card with Approve and Reject buttons, pulling details from the procurement system. Approvals happen on phones between site visits. Because requests arrive in bursts at month end, the team queues outgoing messages and retries politely when Teams throttles. The card updates in place, so everyone sees who approved what.
How do you add AI to a Teams bot safely?
Put the AI layer behind your own service rather than calling a model straight from bot handlers. That gives you one place to swap models, add guardrails and log interactions. Retrieve documents using the user's own permissions, show sources with each answer and require a confirmation card before the bot changes any data.
Data location matters by market. UK and EU users may need hosting in UK or EU regions for UK GDPR comfort, UAE organisations often prefer Microsoft's UAE regions, and Indian clients increasingly ask for India regions under the DPDP Act. Choose the bot host and model region together.
Which practices matter most in production?
- Make handlers idempotent, because Teams retries and users double-click buttons.
- Respect HTTP 429 throttling with exponential backoff, especially for bulk notifications.
- Keep secrets in Key Vault and prefer managed identities.
- Use separate bot registrations for development, staging and production.
- Store state outside the web app so you can scale out.
- Agree app governance with your Teams admins before tenant-wide rollout.
For an internal bot with SSO, a few integrations and an AI component, plan for six to ten weeks from design to rollout. Hosting is usually modest, often USD 30 to 100 a month for a small bot, or roughly GBP 25 to 80, AED 110 to 370 or INR 2,500 to 8,500, with model usage on top.
Key facts
- Azure Bot Service does not charge for messages on standard channels, which include Microsoft Teams; premium channels are billed separately. (Azure Bot Service pricing)
- Adaptive Cards are an open, platform-agnostic card format used by Microsoft Teams and other hosts. (Adaptive Cards)
- Teams apps are described by an app manifest that declares capabilities such as bots, tabs and message extensions. (Microsoft Teams platform documentation)
Key takeaways
- Separate bot identity from user identity, and prefer managed identities.
- Acknowledge quickly and finish slow work through a queue.
- Store conversation references from day one for proactive messages.
- Pick hosting and model regions to suit each market's data expectations.
SWS AI builds Teams apps, bots and Copilot agents connected to business systems. If you want an existing bot reviewed or a new one designed, get in touch.
Frequently asked questions
Do I need Azure Bot Service to build a Teams bot?
For conversational bots, yes. The Azure Bot resource registers the bot and connects it to Teams. Your code can be hosted anywhere with a public HTTPS endpoint, though Azure hosting simplifies identity and networking.
What is the difference between a Teams bot and a Copilot agent?
A Teams bot is your own app with its own logic inside Teams. A Copilot agent extends Microsoft 365 Copilot with your knowledge or actions. Microsoft's newer SDKs let one codebase serve both, so the choice often depends on whether users have Copilot licences.
Can we host a Teams bot in the UK or UAE for data residency?
Yes. Host your bot service, storage and AI models in UK or UAE Azure regions. Some message routing happens within Microsoft's global Teams service, so review Microsoft's data residency documentation for the full picture.
Planning an AI or software project? Talk to our team for a free consultation and an honest estimate.
Previous: Fine-Tuning Small Language Models: When It Beats Bigger Models
Next: IT Careers in Coimbatore: Skills Employers Want in AI and Software