This project demonstrates how to integrate SharePoint documents with Azure AI Foundry using the new SharePoint Connector tool for AI-powered document analysis, announced in Microsoft's latest AI Foundry updates.
Recent Announcement: Microsoft has introduced SharePoint Connector as a preview feature in Azure AI Foundry. Learn more: SharePoint Tools Documentation
| Feature | SharePoint Connector | Microsoft Graph API |
|---|---|---|
| AI Integration | ✅ Native AI agent integration | ❌ Manual integration required |
| Natural Language | ✅ Ask questions in plain English | ❌ Complex query building |
| Document Analysis | ✅ Built-in content understanding | ❌ Raw file access only |
| Complexity | ✅ Simple agent setup | ❌ Complex authentication & parsing |
| Maintenance | ✅ Microsoft-managed | ❌ Custom code maintenance |
- Azure subscription with AI Foundry access
- SharePoint Online site with documents
- Python 3.8+ installed
- Azure CLI installed
- Microsoft 365 Copilot license (Required for SharePoint tool preview)
For complete step-by-step setup with screenshots and detailed instructions:
📖 AI Foundry Project Setup Guide - Create Azure AI Foundry project with screenshots
📋 SharePoint App Registration Guide - Configure SharePoint app with permissions
🔗 SharePoint Connection Setup - Create SharePoint connection in AI Foundry
Test your SharePoint connection directly in the Azure AI Foundry web interface without writing code. This option provides a visual way to verify your setup and test document access through the portal's chat interface.
📖 Portal Testing Guide with Screenshots
Build custom applications using the Azure AI Python SDK to programmatically access SharePoint documents through AI agents. This option provides full control and integration capabilities for enterprise applications.
-
Clone the repository:
git clone https://github.com/your-username/sharepoint-ai-foundry-demo.git cd sharepoint-ai-foundry-demo -
Install dependencies:
pip install -r requirements.txt
-
Configure environment variables: Copy the example file and add your specific values:
cp .env.example .env
Edit
.envwith your Azure AI Foundry project details:PROJECT_ENDPOINT=https://your-project.services.ai.azure.com/api/projects/your-project SHAREPOINT_CONNECTION_ID=/subscriptions/{subscription-id}/resourceGroups/{resource-group}/providers/Microsoft.CognitiveServices/accounts/{account}/projects/{project}/connections/{connection-name} MODEL_DEPLOYMENT_NAME=gpt-4o DOCUMENT_NAME=your-test-document.docx
📖 How to Get Environment Variables - Detailed guide to find all required values
-
Authenticate with Azure:
az login az account set --subscription "your-subscription-id"
Run the main application to test SharePoint document access:
python sample_agents_sharepoint.pyExpected Output:
=== SharePoint AI Agent Demo ===
✅ Created AI Project Client
✅ Created SharePoint Tool
✅ Created agent: asst_abc123
✅ Created thread: thread_xyz789
📝 Processing query: "Summarize the key points of the document"
Agent Response: "Based on the SharePoint document analysis..."
✅ Test completed successfully
Run diagnostic tests to validate all connections:
python testing/diagnostic_sharepoint.pyExpected Output:
=== SharePoint Connection Diagnostic ===
✅ Azure Authentication: Working
✅ AI Project Client: Working
✅ SharePoint Tool Creation: Working
✅ SharePoint Connection: Valid
✅ Document Library Access: Working
🎉 All systems operational!
Run the diagnostic script to validate your setup:
python testing/diagnostic_sharepoint.pyThis will test all connections and show the status of each component.
sharepoint-ai-foundry-demo/
├── 📄 README.md # This file
├── 📄 requirements.txt # Python dependencies
├── 📄 sample_agents_sharepoint.py # Main application
├── 📄 .env.example # Environment template (copy to .env)
├── 📄 LICENSE # MIT License
├── 📁 help/ # Detailed documentation
│ ├── 01-ai-foundry-setup.md
│ ├── 02-sharepoint-app-registration.md
│ ├── 03-sharepoint-connection-setup.md
│ ├── portal-testing-guide.md
│ └── environment-setup.md
└── 📁 testing/ # Test scripts
└── diagnostic_sharepoint.py # Connection diagnostics
For complete step-by-step setup with screenshots and detailed instructions:
- Azure AI Foundry Project Setup - Create AI Foundry project, deploy models, configure endpoints
- SharePoint App Registration - Register app in Azure AD, configure Graph API permissions
- SharePoint Connection Setup - Configure SharePoint connector in AI Foundry with authentication
This project is licensed under the MIT License - see the LICENSE file for details.
Built with ❤️ for the Azure AI community