Introduction:
In this article, I’ll walk you through how I built a fully integrated AI-powered knowledge agent that lives inside Microsoft Teams. This intelligent agent allows users to ask natural language questions directly within Teams and instantly receive summarized answers from documents stored in a SharePoint site. The solution is powered by Azure AI Search for semantic retrieval and leverages the GPT-4.1 model from Azure AI Foundry to generate concise, context-aware responses. Whether you want to streamline internal knowledge access or enhance team productivity, this approach offers a practical and scalable solution.
Overview:
The AI agent is designed to:
- Accept user prompts within Microsoft Teams
- Search documents stored in a SharePoint site
- Summarize relevant content using the GPT-4-1 model from Azure Foundry
This solution includes two integration options:
- A Blazor Server App configured as a Teams App
- A Teams Bot built using the Microsoft 365 Toolkit
Both are connected to Azure AI Search and integrated with Azure Foundry.
If you use Microsoft 365 Copilot, the SharePoint agent creation comes out of the box.
Pre-Requisites:
- Enable Custom Apps Deployment from Org-wide app settings using the Teams admin center
- Azure Foundry Project – With two model deployments
- GPT-4.1 for chat completion
- text-embedding-3-small for embeddings
- Azure AI Search – To import and vectorize the SharePoint site data
- M365 Dev Toolkit–Install it in VS Code for development
- Bot Service Provisioning

Architecture Components
Component | Purpose |
SharePoint Site | Document storage repository |
Azure AI Search | Semantic search engine for indexing and querying SharePoint content (Dependency – It will create an Azure Logic App to schedule the file processing with SharePoint Connector to import and vectorize data) |
Azure Foundry (GPT-4-0 mini) | Summarization and natural language understanding |
Blazor Server App (optional) | Frontend application with Entra ID authentication, another option for the Teams App |
Microsoft 365 Toolkit | Development and deployment framework for Teams Bot and Apps |
Microsoft Teams | End-user interface and collaboration platform |
Index SharePoint Documents in Azure AI Search
- Used Azure AI Foundry to apply the text-embedding-3-small model
- Log in to Azure AI Foundry, select your project, and deploy the text-embedding-3-small model and gpt-4.1.
- text-embedding-3-small model converts text into numerical vectors, capturing semantic meaning and relationships between words, phrases, or sentences. It is a lightweight version optimized for efficiency.
- gpt-4.1 is used as a chat completion model to summarize the content.
- Indexed documents from the SharePoint library into Azure AI Search
- Log in to the Azure portal and create an Azure AI search resource. The basic tier comes with semantic configuration.
- Click on Import and Vectorize data, as shown in the figure below.
- From the next screen, select SharePoint as a data source.
- This data source connector indexes SharePoint documents using the Azure Logic App workflow.
- Note: An Additional cost will be added based on Logic App consumption
- Next step, select your deployed text embedding model to vectorize the text
- The Logic Apps Managed Identity Authentication type is recommended.
- Review and create – This will create a workflow template to process and index a document using Azure Open AI and Azure AI Search.
- The workflow gets the document, parses the content, and chunks the text based on token size. The workflow then processes each chunk to generate embeddings through an OpenAI deployment. The text chunks and their embeddings are mapped to a schema suitable for Azure AI Search. Finally, the documents are indexed in Azure AI Search for efficient retrieval and analysis.
- Make sure all connections are in green and click on Use this template.
- In the next step, provide the parameters. Enter your SharePoint site and library name.
- Finally, clicking review+update will initiate the logic app workflow to vectorize the files.
- Note: This workflow template triggers when the Request trigger receives a request, vectorizes files from a Microsoft SharePoint Online library, and writes the files to the Azure AI Search vector store.
- Created a semantic configuration to enable relevance scoring and natural language queries
- After the index creation, select Indexes from the Search Management blade and select your index. Select a semantic configuration, add a semantic configuration, and configure it.
- Pricing – Preferred Basic Tier (Includes Semantic ranker) for Development
- After the index creation, select Indexes from the Search Management blade and select your index. Select a semantic configuration, add a semantic configuration, and configure it.
Build the Blazor Server App (Optional)
- Built a Blazor Server application with Microsoft Entra ID authentication
- Integrated Azure AI Search query functionality
- Called the Azure Foundry GPT-4-0 mini model to summarize results
- Displayed summarized content and original SharePoint document links in the UI
- Please refer to the source code in the GitHub repo
Create a Bot Using the Microsoft 365 Toolkit
- Use Visual Studio Code and the Microsoft 365 Toolkit to scaffold a Teams Bot project
- Connect your M365 account and Azure account
- Note: Ensure you opened VS Code as an Admin
- Connect your M365 account and Azure account
- Create an Agent/App
- Select Create new agent/app from the Development Blade as shown in the figure below
- Select Agent for Teams -> Chat with your data -> Azure AI Search -> Azure OpenAI – Select the language, I used TypeScript.
- Assign the values and secret for the Azure Open AI endpoints and Azure AI Search Endpoints in the env.playground.user file. Now run the program to test the chat experience in a local browser.
- Select Create new agent/app from the Development Blade as shown in the figure below
- Provisioning, Deploy, and Publish
- Select Provision under Lifecycle Blade, using the Bicep template in the Source to create all required resources (Azure Bot and App services) in Azure.
- Select Deploy under Lifecycle Blade. Using the Bicep template, the toolkit will create an app package and deploy it to the web app.
- Publish to Organization. This option is used to publish the application to Teams.
- Select Provision under Lifecycle Blade, using the Bicep template in the Source to create all required resources (Azure Bot and App services) in Azure.

Conclusion:
This article shows how to build an AI-powered knowledge agent inside Microsoft Teams that allows users to search and summarize SharePoint documents using natural language queries. The solution leverages Azure AI Search to index and retrieve content from a SharePoint site and uses the GPT-4.1 model from Azure AI Foundry to generate smart summaries. The bot seamlessly integrates with Teams, allowing users to interact with enterprise knowledge conversationally. This guide covers everything from indexing SharePoint content to building the Teams agent and deploying and publishing it across your organization.