Skip to main content

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

Choosing Your SDK

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 via DefaultAzureCredential:

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

Example: Content Safety

Troubleshooting

Authentication Errors

If you see DefaultAzureCredential failed to retrieve a token:
  1. Verify Azure CLI is authenticated:
  2. Check RBAC role assignment:
    • Confirm you have at least the Azure AI User role on the Foundry project
  3. For managed identity in production:
    • Ensure the managed identity has the appropriate role assigned

Endpoint Configuration Errors

If you see Connection 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 with AttributeError 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