Deploy agents to Microsoft Teams and Copilot
In this lab, you’ll learn how to publish AI agents to Microsoft Teams and Microsoft 365 Copilot so employees can access them where they already work. You’ll create a simple agent in the Foundry portal, add knowledge grounding, then deploy it to both platforms.
This lab focuses on deployment and publishing workflows, not agent development.
This lab takes approximately 40 minutes.
Note: Publishing to Microsoft 365 Copilot requires a Copilot license. The Teams deployment works with standard Microsoft 365 accounts.
Learning Objectives
By the end of this lab, you’ll be able to:
- Create a basic agent quickly in the Microsoft Foundry portal
- Add knowledge grounding using file search
- Publish agents to Microsoft Teams as a custom app
- Publish agents to Microsoft 365 Copilot as an extension
- Understand the differences between Teams and Copilot deployment
- Manage and update published agents
Prerequisites
Before starting this lab, ensure you have:
- Azure subscription with permissions to create AI resources
- Microsoft 365 account with Teams access
- Microsoft 365 Copilot license (optional, for Copilot deployment)
- Basic familiarity with the Microsoft Foundry portal
Scenario
You’ll deploy an Enterprise Knowledge Agent that:
- Answers questions about company policies
- Uses uploaded documents for grounding
- Is accessible via Microsoft Teams chat
- Is available as a Copilot extension (optional)
Create an Agent in the Portal
First, you’ll quickly create an agent using the Microsoft Foundry portal. This takes about 5 minutes.
Open the Foundry portal
-
Open your browser and navigate to the Foundry portal at
https://ai.azure.com -
Sign in with your Azure credentials
-
If prompted, select your subscription and create or select a project
Create a new agent
-
In the Foundry portal, select Build from the left navigation
-
Select Agents
-
Click + New agent
- Configure the agent:
-
Name:
enterprise-knowledge-agent - Description: Enterprise assistant for company policies and information
-
Name:
-
Set the Instructions to:
You are an Enterprise Knowledge Assistant for Contoso Corporation. Your role: - Answer questions about company policies and procedures - Provide accurate information from uploaded documents - Be professional, helpful, and concise - If you don't know the answer, say so and suggest who to contact Always cite your sources when referencing specific policies. - Click Create
Your agent is now created! You’ll see the agent playground where you can test it.
Quick test
- In the chat panel, send a test message:
Hello! What can you help me with? - The agent should respond explaining it’s an Enterprise Knowledge Assistant
The agent works, but it doesn’t have any company knowledge yet. Let’s add that next.
Add Knowledge with File Search
Now you’ll add company documents so the agent can answer questions with real information.
Enable file search
-
In your agent’s configuration, scroll to the Tools section
-
Enable File search
-
Click Save
Upload company documents
-
Under File search, click Upload files
-
Download the sample policy documents. Open new browser tabs and save each file:
IT Security Policy:
https://raw.githubusercontent.com/MicrosoftLearning/mslearn-ai-agents/main/Labfiles/05a-m365-teams-integration/Python/sample_documents/it_security_policy.txtRemote Work Policy:
https://raw.githubusercontent.com/MicrosoftLearning/mslearn-ai-agents/main/Labfiles/05a-m365-teams-integration/Python/sample_documents/remote_work_policy.txt -
Return to the Foundry portal and upload both files
-
Wait for the files to be indexed (you’ll see a confirmation for each)
Test with knowledge queries
- In the playground, ask a question about IT security:
What are the password requirements for my laptop? -
The agent should provide specific information from the IT security policy (minimum 12 characters, uppercase, lowercase, numbers, special characters, etc.)
- Try a question about remote work:
What are the core hours for remote employees? -
The agent should respond with information from the remote work policy (9 AM - 3 PM)
- Try another query:
What encryption is required on company laptops? - Notice how the agent finds the right document and provides accurate answers about BitLocker requirements
Your agent now has knowledge grounding! It can answer questions based on your company documents.
Publish to Microsoft Teams
Now you’ll publish your agent to Microsoft Teams so employees can chat with it directly in Teams.
What gets created
When you publish to Teams, the Foundry portal automatically:
- Creates an Azure Bot Service
- Generates a Teams app manifest
- Packages app icons and configuration
- Provides a downloadable app package
Prepare app information
Before publishing, gather this information:
| Field | Value |
|---|---|
| App Name | Enterprise Knowledge Agent |
| Short Description | AI assistant for company policies |
| Full Description | Enterprise AI assistant that answers questions about company policies, IT procedures, and employee resources |
| Developer Name | Your name or company name |
| Website URL | https://contoso.com (placeholder is fine for lab) |
| Privacy Policy URL | https://contoso.com/privacy |
| Terms of Use URL | https://contoso.com/terms |
Create app icons
You’ll need two icons for the Teams app:
-
Color icon (192x192 pixels)
- Full color version of your app logo
- PNG format
-
Outline icon (32x32 pixels)
- White outline on transparent background
- PNG format
- Used in the Teams sidebar
Quick option for this lab: Create a simple colored square with text or initials using PowerPoint, Paint, or an online tool like Canva.
Publish from the portal
-
In the Foundry portal, open your agent (Build → Agents → enterprise-knowledge-agent)
-
Click the Publish button at the top of the page
-
Select Microsoft Teams as the deployment target
-
Click Continue
Configure Teams app details
Fill in the configuration form:
Basic Information:
- App Name: Enterprise Knowledge Agent
- Short Description: AI assistant for company policies
- Full Description: Enterprise AI assistant that answers questions about company policies, IT procedures, and employee resources
Developer Information:
- Developer Name: Your name
- Website: https://contoso.com
- Privacy Policy: https://contoso.com/privacy
- Terms of Use: https://contoso.com/terms
App Icons:
- Upload your color icon (192x192 px)
- Upload your outline icon (32x32 px)
App Scope:
- Select Personal for individual chat access
- Optionally select Team for channel access
Click Prepare Agent
Deploy to Teams
After the agent package is prepared (this takes 1-2 minutes), you have two options:
Option A: Direct publish (recommended)
This option publishes directly to Teams without manually uploading a package:
-
When the package is ready, select Continue the in-product publishing flow
- Choose your publish scope:
- Shared scope: Agent appears under “Your agents” in the Teams agent store. No admin approval required. Best for personal testing.
- Organization scope: Agent appears under “Built by your org” for all users. Requires admin approval.
-
For this lab, select Shared scope
-
Click Publish
-
Wait for publishing to complete (you’ll see a success message)
- Your agent is now available in Teams! Find it under Apps → Your agents
Option B: Download and manually upload
This option gives you a package to upload manually, useful for testing or when direct publishing isn’t available:
-
When the package is ready, click Download the package
-
Save the
manifest.zipfile to your computer -
Open Microsoft Teams (desktop app or https://teams.microsoft.com)
-
Click Apps in the left sidebar
-
Click Manage your apps at the bottom left
-
Click Upload an app → Upload a custom app
-
Browse and select your downloaded
manifest.zip -
Review the app details and click Add
The app will install and open automatically.
Test your agent in Teams
-
The agent chat should open after installation (or find it under Apps → Your agents)
- Send a greeting:
Hello! What can you help me with? - Test a knowledge query:
What are the laptop password requirements? - Try another question:
What MFA methods are supported? - The agent should respond with information from the IT security policy document!
🎉 Congratulations! Your agent is now available in Microsoft Teams!
Sharing with others
For personal use:
- The app is already installed for you
For team-wide access:
- Go to a Team channel
- Click + to add a tab or app
- Search for your app name
- Add it to the channel
For organization-wide access:
- Contact your Teams administrator
- They can publish the app to the organization’s app catalog
- All employees can then find and install it
Troubleshooting Teams deployment
Can’t find the agent in Teams (after direct publish):
- Check the Apps → Your agents section in Teams
- Wait 1-2 minutes for the agent to appear after publishing
- Verify publishing completed successfully in the Foundry portal
Can’t upload the app (manual upload):
- Ensure the manifest.zip file isn’t corrupted (re-download if needed)
- Check that your Teams admin hasn’t disabled custom app uploads
- Verify the icons are the correct sizes (192x192 and 32x32)
Agent doesn’t respond:
- Wait 30 seconds after installation for the bot to initialize
- Check that the Azure Bot Service was created (shown during publishing)
- Test the agent in the Foundry playground first
Responses are generic (no knowledge):
- Verify file search is enabled on the agent
- Confirm documents were uploaded and indexed
- Test knowledge queries in the Foundry playground
Publish to Microsoft 365 Copilot
Now you’ll publish your agent as a Microsoft 365 Copilot extension, allowing users to access it directly within Copilot.
Note: This section requires a Microsoft 365 Copilot license. If you don’t have one, you can read through the steps to understand the process.
Understanding Copilot extensions
When you publish to Copilot, your agent becomes a Copilot extension (also called a plugin or declarative agent). Users can:
- Invoke your agent using @mentions in Copilot
- Access your agent’s knowledge alongside Copilot’s capabilities
- Switch between Copilot and your agent seamlessly
Differences: Teams vs Copilot
| Aspect | Teams App | Copilot Extension |
|---|---|---|
| Access | Standalone chat in Teams | Within Microsoft 365 Copilot |
| Invocation | Open the app directly | @mention or select from extensions |
| Context | Isolated conversation | Can combine with Copilot’s context |
| License | Standard M365 | Requires Copilot license |
| Discovery | Teams app store | Copilot extensions panel |
Publish from the portal
-
Return to the Foundry portal (https://ai.azure.com)
-
Navigate to your agent (Build → Agents → enterprise-knowledge-agent)
-
Click the Publish button
-
Select Publish to Teams and Microsoft 365 Copilot
-
Click Continue
Note: This is the same publishing flow used for Teams. The agent becomes available in both Teams and Copilot through a single publishing process.
Configure publishing details
If you haven’t already published this agent, fill in the configuration (same as the Teams section):
- Name: Enterprise Knowledge Agent
- Description: AI assistant for company IT policies
- Icons: Upload your 192x192 and 32x32 icons
- Publisher information: Your name and placeholder URLs
Choose publish scope
Select your distribution scope:
| Scope | Visibility | Admin Approval | Best For |
|---|---|---|---|
| Shared | Under “Your agents” in agent store | Not required | Personal testing, small teams |
| Organization | Under “Built by your org” for all users | Required | Organization-wide distribution |
For this lab, select Shared scope for immediate access without admin approval.
Complete publishing
-
Click Prepare Agent and wait for packaging (1-2 minutes)
-
Select Continue the in-product publishing flow
-
Confirm your scope selection and click Publish
-
Wait for publishing to complete
Access in Microsoft 365 Copilot
Once published with shared scope, your agent is immediately available:
-
Open Microsoft 365 Copilot (copilot.microsoft.com or in Microsoft 365 apps)
-
Look for the agent store or Extensions panel
-
Find your agent under Your agents (for shared scope)
- Start a conversation:
@Enterprise Knowledge Agent What are the laptop security requirements? - Or select your agent and ask directly:
What MFA methods are supported for company systems? - Copilot routes the query to your agent and returns information from the IT security policy
Note: For organization scope, an admin must first approve the app in the Microsoft 365 admin center under Requests. Once approved, the agent appears under Built by your org for all users.
Managing your published agent
Update the agent:
- Make changes to your agent in the Foundry portal (instructions, documents, tools)
- Minor changes take effect automatically
- Major changes may require re-publishing
Monitor usage:
- Check analytics in the Foundry portal
- Review conversation logs
- Monitor for errors or issues
Unpublish:
- In the Foundry portal, go to your agent’s details
- Find the publish status section
- Click Unpublish to remove access from Teams and Copilot
Update Published Agents
After publishing, you may need to update your agent. Here’s how updates work.
Making changes
-
In the Foundry portal, open your agent
- Make your changes:
- Update instructions
- Add or remove documents
- Modify tool settings
- Click Save
Propagating updates
For Teams apps:
- Instruction and document changes take effect immediately
- No need to re-upload the manifest
- Users see updated responses in their next conversation
For Copilot extensions:
- Minor changes (instructions, documents) may take effect automatically
- Major changes may require re-submission for approval
- Check the publish status for any pending reviews
Version management
Best practices for managing agent versions:
- Document changes: Keep a changelog of updates
- Test before publishing: Always test in the playground first
- Communicate updates: Let users know about significant changes
- Monitor after updates: Watch for issues after deploying changes
Cleanup
To avoid unnecessary charges, clean up resources when done.
Delete the agent
-
In the Foundry portal, go to Build → Agents
-
Find enterprise-knowledge-agent
-
Click the … menu → Delete
-
Confirm deletion
This also removes:
- The Azure Bot Service
- Associated configurations
- Published deployments
Uninstall from Teams
-
Open Microsoft Teams
-
Go to Apps → Manage your apps
-
Find Enterprise Knowledge Agent
-
Click … → Uninstall
-
Confirm uninstallation
Remove Copilot extension
If you published to Copilot:
- The extension becomes inactive when the agent is deleted
- Users will see an error if they try to use it
- Admin may need to remove it from the organization catalog
Summary
Congratulations! 🎉 You’ve completed this lab!
What You Accomplished
| Task | Status |
|---|---|
| Created an agent in the Foundry portal | ✅ |
| Added knowledge with file search | ✅ |
| Published to Microsoft Teams | ✅ |
| Published to Microsoft 365 Copilot | ✅ |
| Learned to update published agents | ✅ |
Key Takeaways
Teams deployment:
- Quick to set up using the Foundry portal
- Creates Azure Bot Service automatically
- Users access via Teams app
- Good for standalone chat experiences
Copilot deployment:
- Integrates with Microsoft 365 Copilot
- Users invoke via @mention or selection
- Requires Copilot license
- Good for contextual assistance within Copilot
Best practices:
- Test thoroughly in playground before publishing
- Keep documents up to date for accurate responses
- Monitor usage and feedback
- Update instructions based on user needs
When to Use Each Platform
| Use Case | Recommended Platform |
|---|---|
| Dedicated support chat | Teams |
| Quick policy lookups | Copilot |
| Team-specific assistant | Teams (channel) |
| Organization-wide knowledge | Both |
| Integration with M365 workflow | Copilot |
| Standalone conversational experience | Teams |
Next Steps
To build on this lab:
- Add more documents for comprehensive knowledge coverage
- Customize instructions for specific use cases
- Add tools like code interpreter for advanced capabilities
- Implement authentication for sensitive information
- Set up monitoring to track usage and quality
Troubleshooting Reference
Teams Issues
| Issue | Solution |
|---|---|
| Can’t upload custom app | Check Teams admin settings for custom app policy |
| App won’t install | Verify manifest.zip isn’t corrupted; check icon sizes |
| Agent not responding | Test in Foundry playground first; wait 30 seconds after install |
| Generic responses | Verify file search enabled and documents indexed |
| “Bot not found” error | Check Bot Service is running in Azure portal |
Copilot Issues
| Issue | Solution |
|---|---|
| Extension not appearing | Check approval status; may be pending admin review |
| @mention not working | Ensure extension is enabled in your Copilot settings |
| Wrong responses | Test agent in Foundry playground; check document content |
| “Extension unavailable” | Verify agent is running and not deleted |
| Approval rejected | Review rejection reason; update and resubmit |
General Issues
| Issue | Solution |
|---|---|
| Agent not saving | Check browser connection; try refreshing |
| Documents not indexing | Wait a few minutes; try re-uploading |
| Slow responses | Large documents take longer; consider chunking |
| Incorrect citations | Review document content and formatting |
Additional Resources
Microsoft Documentation:
Tools:
Lab Complete! 🎉
You’ve successfully deployed an AI agent to both Microsoft Teams and Microsoft 365 Copilot!