A comprehensive AI-powered search solution based on Azure AI Search multimodal capabilities, featuring a .NET 9 backend API and a .NET 9 Razor Pages frontend with Azure AD authentication.
π Attribution: This .NET implementation is inspired by and based on the Azure AI Search Multimodal Sample Python repository. We've adapted the concepts and functionality to the .NET ecosystem while adding enterprise-grade features like Azure AD authentication and a modern Razor Pages frontend.
π€ AI-Assisted Development: This project was developed with significant assistance from AI tools, demonstrating effective human-AI collaboration. Primary AI partners: Claude Sonnet 4 (Anthropic) for architecture and code generation, and GPT-5 Preview (OpenAI) for refinement and optimization. The result showcases how AI can accelerate development while maintaining high code quality and comprehensive documentation.
AISearch/
βββ dotnet/
β βββ AISearch.Web/ # .NET 9 Razor Pages/MVC frontend
β βββ AISearch.Api/ # .NET 9 Web API backend
β βββ AISearch.Core/ # Core business logic and models
βββ docs/ # Documentation
βββ scripts/ # Build and deployment scripts
- Frontend Layer: .NET 9 Razor Pages with Azure AD authentication
- API Layer: .NET 9 Web API with comprehensive REST endpoints
- Business Logic: Clean architecture with dependency injection
- Azure Services: AI Search, OpenAI, Document Intelligence, Storage
- Authentication: Azure AD with token management and refresh
- Data Flow: Document processing β Embedding generation β Vector search β AI chat
- Document Management: Upload, index, and manage multimodal documents
- AI Search Interface: Semantic search with configurable parameters
- Chat Interface: Interactive chat with document grounding
- Index Management: Visual index creation and configuration
- Azure AD Authentication: Secure login with Microsoft Identity
- Material Design UI: Bootstrap-based responsive interface
- Real-time Updates: AJAX-powered interactions with jQuery
- Document Management: Upload, index, and manage multimodal documents
- AI Search: Semantic search with Azure AI Search
- Vector Search: Embedding-based similarity search
- Multimodal RAG: Chat interface with document grounding
- Index Management: Create and manage search indexes
- Swagger Documentation: Interactive API testing
- Azure Integration: AI Search, OpenAI, Document Intelligence, and Storage services
- .NET 9 SDK
- Visual Studio 2022 or VS Code
- Azure subscription with:
- Azure AI Search service
- Azure OpenAI service
- Azure Storage account
- Azure Document Intelligence service
- Azure AD app registration
-
Navigate to frontend directory:
cd dotnet/AISearch.Web -
Configure application settings: Update
appsettings.jsonwith your Azure service credentials:{ "Logging": { "LogLevel": { "Default": "Information", "Microsoft.AspNetCore": "Warning", "Microsoft.AspNetCore.Authentication": "Information", "Microsoft.Identity.Web": "Information" } }, "AllowedHosts": "*", "UseSimpleAuth": true, "ApiSettings": { "BaseUrl": "https://localhost:7001" }, "AzureAd": { "Instance": "https://login.microsoftonline.com/", "Domain": "your-domain.onmicrosoft.com", "ClientId": "your-client-id", "TenantId": "your-tenant-id", "CallbackPath": "/signin-oidc", "SignedOutCallbackPath": "/signout-callback-oidc", "ClientSecret": "your-client-secret" }, "DownstreamApi": { "BaseUrl": "https://localhost:7001", "Scopes": "User.Read" } } -
Restore dependencies:
dotnet restore
-
Build and run:
dotnet build dotnet run
-
Access application: Open
https://localhost:7002
-
Navigate to backend directory:
cd dotnet/AISearch.Api -
Configure application settings: Update
appsettings.jsonwith your Azure service credentials:{ "AzureSearch": { "ServiceEndpoint": "https://your-search-service.search.windows.net", "IndexName": "knowledge-index", "SearchAdminKey": "your-search-admin-key", "OpenAIEndpoint": "https://your-openai-service.openai.azure.com", "OpenAIModelName": "gpt-4", "OpenAIDeploymentName": "gpt-4", "OpenAIEmbeddingModel": "text-embedding-3-large", "OpenAIEmbeddingDeploymentName": "text-embedding-3-large", "VectorDimensions": 3072, "OpenAIApiKey": "your-openai-api-key", "StorageAccountUrl": "https://your-storage.blob.core.windows.net", "StorageAccountKey": "your-storage-key", "ArtifactsContainer": "artifacts", "SamplesContainer": "samples", "KnowledgeAgentName": "knowledge-agent", "DocumentIntelligenceEndpoint": "https://your-doc-intelligence.cognitiveservices.azure.com/", "DocumentIntelligenceApiKey": "your-doc-intelligence-key" }, "AzureAd": { "Instance": "https://login.microsoftonline.com/", "Domain": "your-domain.onmicrosoft.com", "ClientId": "your-client-id", "TenantId": "your-tenant-id", "Audience": "your-client-id" } } -
Build and run:
dotnet build dotnet run
-
Access Swagger UI: Open
https://localhost:7001/swagger
Document processing pipeline from upload to search and chat interactions
- Document Upload β Azure Storage + Document Intelligence
- Content Extraction β Text, tables, images processing
- Intelligent Chunking β Optimal content segmentation
- Embedding Generation β OpenAI text-embedding-3-large
- Vector Indexing β Azure AI Search with hybrid capabilities
- Search & Chat β Semantic search + GPT-4 chat completions
POST /api/documents/upload- Upload and index documentsGET /api/documents- List all documentsGET /api/documents/{id}- Get document detailsDELETE /api/documents/{id}- Delete documentPOST /api/documents/{id}/reindex- Re-index document
POST /api/search- Perform text/semantic searchPOST /api/search/vector- Vector similarity searchPOST /api/search/similar/{documentId}- Find similar documents
POST /api/chat- Chat with document groundingPOST /api/chat/stream- Streaming chat responses
POST /api/indexes- Create new search indexGET /api/indexes- List all indexesGET /api/indexes/{name}- Get index detailsDELETE /api/indexes/{name}- Delete index
- .NET 9: Latest .NET framework
- ASP.NET Core Razor Pages/MVC: Web framework
- Azure AD Authentication: Microsoft Identity integration
- Bootstrap 5: Responsive CSS framework
- jQuery: JavaScript library for DOM manipulation
- Material Icons: Google Material Design icons
- AJAX: For seamless API integration
- .NET 9: Latest .NET framework
- Azure AI Search SDK: For search and indexing capabilities
- Azure.AI.OpenAI: For embeddings and chat completions
- Azure Storage Blobs: For document storage
- Azure Document Intelligence: For document processing
- Swagger/OpenAPI: API documentation
- Azure.Search.Documents: Search operations
- Azure.AI.DocumentIntelligence: Document processing
- Azure.Identity: Authentication
- Microsoft.Extensions: Dependency injection and configuration
Create appsettings.Development.json for local development:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"UseSimpleAuth": true,
"ApiSettings": {
"BaseUrl": "https://localhost:7001"
},
"AzureAd": {
"Instance": "https://login.microsoftonline.com/",
"Domain": "your-dev-domain.onmicrosoft.com",
"ClientId": "your-dev-client-id",
"TenantId": "your-dev-tenant-id"
}
}The application supports multiple authentication modes:
- Enhanced Auth: Full Azure AD integration with token refresh
- Simple Auth: Basic Azure AD authentication
- Standard Auth: Default authentication mode
Configure in appsettings.json:
{
"UseSimpleAuth": true,
"UseEnhancedAuth": false
}-
Start the API backend:
cd dotnet/AISearch.Api dotnet runAPI will be available at:
https://localhost:7001 -
Start the Razor Pages frontend:
cd dotnet/AISearch.Web dotnet runWeb app will be available at:
https://localhost:7002 -
Access the application:
- Frontend:
https://localhost:7002 - API:
https://localhost:7001 - Swagger UI:
https://localhost:7001/swagger
- Frontend:
-
Build for production:
dotnet publish -c Release -o ./publish
-
Configure production settings in
appsettings.Production.json -
Deploy to Azure App Service or your preferred hosting platform
- Navigate to
https://localhost:7002 - Sign in with your Azure AD credentials
- Use the navigation menu to access different features
curl -X POST "https://localhost:7001/api/documents/upload" \
-H "Content-Type: multipart/form-data" \
-F "file=@document.pdf" \
-F "title=My Document" \
-F "description=Document description"curl -X POST "https://localhost:7001/api/search" \
-H "Content-Type: application/json" \
-d '{
"query": "artificial intelligence",
"top": 10,
"threshold": 0.7
}'curl -X POST "https://localhost:7001/api/chat" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{
"role": "user",
"content": [{"type": "text", "text": "What is machine learning?"}]
}
],
"useGrounding": true
}'- Home: Dashboard with authentication status
- Search: Advanced search interface with filters and configuration
- Chat: Interactive chat with document grounding
- Document Management: Upload and manage documents
- Index Management: Create and configure search indexes
- Material Design: Consistent with modern web standards
- Responsive Layout: Works on desktop and mobile devices
- Real-time Feedback: Loading states and progress indicators
- Error Handling: User-friendly error messages
- Authentication Flow: Seamless Azure AD integration
- Azure AD Authentication: Secure user authentication
- CSRF Protection: Built-in request forgery protection
- XSS Prevention: Input sanitization and encoding
- Token Management: Automatic token refresh
- Secure Headers: Security headers configuration
- Input Validation: Server-side validation
- CORS Configuration: Proper cross-origin resource sharing
- β Frontend (.NET 9 Razor Pages) - Build Successful
- β Backend (.NET 9 API) - Build Successful
- β Core Library (.NET 9) - Build Successful
β οΈ Configuration Required - Azure service credentials needed
This .NET implementation is based on the excellent work from the Azure Samples team:
Azure AI Search Multimodal Sample
- Original Python/FastAPI implementation
- Comprehensive multimodal search capabilities
- Streamlit frontend for quick prototyping
- Excellent documentation and examples
- Enterprise Authentication: Full Azure AD integration with token management
- Razor Pages Frontend: Server-side rendered UI with modern responsive design
- Type Safety: Strong typing with C# throughout the application
- Performance: Optimized for .NET runtime performance characteristics
- Security: Enhanced security features built into ASP.NET Core
- Deployment: Ready for enterprise deployment scenarios
- AI-Assisted Development: Built using modern AI development tools and practices
This project demonstrates AI-Assisted Development best practices:
- Human Vision + AI Implementation: Strategic decisions by humans, rapid implementation with AI
- Iterative Refinement: Continuous improvement through human-AI collaboration
- Quality Assurance: Human oversight ensuring production-ready code
- Documentation: Comprehensive documentation generated with AI assistance
- Fork the repository
- Create a feature branch
- Follow the existing code style and patterns
- Ensure all features maintain UI consistency
- Add appropriate error handling and loading states
- Test across different browsers and device sizes
- Submit a pull request
This project is licensed under the MIT License.
For issues and questions:
- Check the Swagger documentation at
https://localhost:7001/swagger - Review the configuration section above
- Ensure all Azure services are properly configured
- Check the application logs for detailed error information
- Verify Azure AD app registration settings
- .NET 9 SDK installed
- Azure subscription active
- Azure AI Search service created
- Azure OpenAI service deployed
- Azure Document Intelligence service configured
- Azure Storage account configured
- Azure AD app registration completed
- Application settings configured
- Dependencies restored
- Performance Improvements: Enhanced runtime performance and memory management
- C# 13 Features: New language features and syntax improvements
- ASP.NET Core Enhancements: Better performance and new features
- Enhanced Security: Improved security features and vulnerability mitigation
- β
Updated all project files to target
net9.0 - β Upgraded Microsoft packages to version 9.0.0
- β Maintained Azure SDK versions (they are .NET 9 compatible)
- β Updated documentation to reflect .NET 9
- Install .NET 9 SDK: Download from Microsoft .NET Downloads
- Restore packages: Run
dotnet restorein each project directory - Build and test: Verify all projects build successfully
- Update CI/CD: Update build pipelines to use .NET 9
Note: Make sure to configure your Azure services and update both appsettings.json files (Web and API projects) before running the application. The frontend requires the backend API to be running for full functionality.
AI Development Note: This project showcases the potential of AI-assisted development, combining human expertise with AI capabilities to create production-ready software efficiently and effectively.
