Microsoft Foundry SDKs and Endpoints
Microsoft Foundry provides unified access to models, agents, and tools through multiple SDKs and endpoints. This guide helps you choose the right SDK for your scenario.SDK Overview
| SDK | Purpose | Endpoint |
|---|---|---|
| Foundry SDK | Foundry-specific capabilities with OpenAI-compatible interfaces | https://<resource-name>.services.ai.azure.com/api/projects/<project-name> |
| OpenAI SDK | Latest OpenAI models with full OpenAI API surface | https://<resource-name>.openai.azure.com/openai/v1 |
| Foundry Tools SDKs | Prebuilt AI services (Vision, Speech, Language, etc.) | Service-specific endpoints |
| Agent Framework | Multi-agent orchestration in code (cloud-agnostic) | Uses project endpoint via Foundry SDK |
Choosing Your SDK
- Foundry SDK
- OpenAI SDK
- Foundry Tools SDKs
- Agent Framework
Use when building apps with:
- Agents and agent orchestration
- Evaluations and testing
- Foundry-specific features
- Unified access to multiple services
Foundry SDK
The Foundry SDK connects to a single project endpoint that provides access to all Foundry capabilities.Installation
Authentication
The Foundry SDK uses Microsoft Entra ID authentication viaDefaultAzureCredential:
Using the Foundry SDK
The SDK exposes two client types:Project Client
Use for Foundry-native operations like listing connections and retrieving project properties.OpenAI-Compatible Client
Use for agents, evaluations, and model inference.What You Can Do with the Foundry SDK
- Access Foundry Models (Azure OpenAI and Foundry Direct models)
- Create and manage agents
- Run cloud evaluations
- Enable application tracing
- Fine-tune models
- Get endpoints and keys for Foundry Tools
OpenAI SDK
Use the OpenAI SDK for direct access to Azure OpenAI models with full OpenAI API compatibility.Installation and Usage
Foundry Tools SDKs
Foundry Tools (formerly Azure AI Services) provide specialized AI capabilities through dedicated SDKs.Endpoints by Service
| Service | Endpoint Format |
|---|---|
| Computer Vision, Language, Translation | https://<resource-name>.cognitiveservices.azure.com/ |
| Speech to Text | https://<region>.stt.speech.microsoft.com |
| Text to Speech | https://<region>.tts.speech.microsoft.com |
| Text Translation | https://api.cognitive.microsofttranslator.com/ |
Example: Content Safety
Troubleshooting
Authentication Errors
If you seeDefaultAzureCredential failed to retrieve a token:
-
Verify Azure CLI is authenticated:
-
Check RBAC role assignment:
- Confirm you have at least the Azure AI User role on the Foundry project
-
For managed identity in production:
- Ensure the managed identity has the appropriate role assigned
Endpoint Configuration Errors
If you seeConnection refused or 404 Not Found:
- Verify resource and project names match your deployment
- Check endpoint URL format
- For custom subdomains, replace
<resource-name>with your custom subdomain
SDK Version Mismatches
If code samples fail withAttributeError or ModuleNotFoundError:
- Check SDK version:
pip show azure-ai-projects(Python) - Verify you’re using the correct SDK version for your portal (2.x for new, 1.x for classic)
- Reinstall with correct version flags
Next Steps
Quickstart
Build your first Foundry application
Agents
Create intelligent agents
Models
Explore available models
Tools
Extend agent capabilities