A REST API built with FastAPI for interacting with Azure Machine Learning's AutoML capabilities. This service provides unified HTTP endpoints to manage datasets, run experiments, and deploy models.
- Dataset Management: Upload and manage ML datasets
- AutoML Experiments: Launch and monitor automated ML experiments
- Model Management: Browse registered models and deployment endpoints
- Azure AD Integration: Production-ready authentication with token exchange
- MCP Server: Expose API as Model Context Protocol server for AI agents
- Background Tasks: Async processing for long-running operations
-
Install dependencies:
uv sync
-
Set up environment (create
.env
file):JWT_SECRET=your-secret-key AZURE_TENANT_ID=your-tenant-id AZURE_CLIENT_ID=your-client-id AZURE_CLIENT_SECRET=your-client-secret AZURE_SUBSCRIPTION_ID=your-subscription-id AZURE_ML_WORKSPACE=your-workspace-name AZURE_ML_RESOURCE_GROUP=your-resource-group
-
Initialize database:
uv run python scripts/create_tables.py
-
Start the server:
uv run python -m automlapi.runserver
Server runs at
http://localhost:8005
Generate a test token and try the API:
# Generate test token
uv run python scripts/create_token.py testuser dev-tenant 24
# Test endpoints
TOKEN="your-generated-token"
curl -H "Authorization: Bearer $TOKEN" http://localhost:8005/auth/me
curl -H "Authorization: Bearer $TOKEN" http://localhost:8005/datasets
POST /auth/exchange
– Exchange Azure AD token for API tokenGET /auth/me
– Get current user infoGET|POST /datasets
– Manage datasetsGET|POST /experiments
– Manage AutoML experimentsGET /runs
– List experiment runsGET /models
– List registered modelsGET|POST /endpoints
– Manage deployment endpoints
- Swagger UI:
http://localhost:8005/docs
- ReDoc:
http://localhost:8005/redoc
- OpenAPI JSON:
http://localhost:8005/openapi.json
For detailed setup and usage instructions, see the documentation in the /docs
folder:
- Installation Guide - Dependencies, prerequisites, and setup
- Authentication Guide - Azure AD integration and security
- Database Setup - Azure SQL Database configuration
- API Reference - Complete endpoint documentation
- Testing Guide - Testing approaches and examples
- Deployment Guide - Production deployment and MCP server
- RBAC Guide - Role-based access control system
The API supports two modes:
- Local Development: Uses SQLite (
ENVIRONMENT=local
) - Production: Uses Azure SQL Database (
ENVIRONMENT=production
)
Run the test suite:
uv run pytest
For comprehensive testing approaches including custom tokens, Postman, and automated testing, see the Testing Guide.
Frontend (React/Vue/etc)
↓ (Azure AD authentication)
Azure AutoML API (FastAPI)
↓ (Service Principal auth)
Azure ML Workspace
↓ (Metadata storage)
Azure SQL Database
The API acts as a secure middleware layer between your frontend applications and Azure ML services, handling authentication, data management, and experiment orchestration.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.