Skip to main content

.NET SDK Overview

The .NET SDKs provide comprehensive access to Azure AI services including Foundry Local, Azure Machine Learning, and Azure AI Search. This guide covers installation, authentication, and usage examples for C#.

Installation

Azure AI Foundry SDK

Foundry Local SDK

Azure Machine Learning

Authentication

All SDKs support Azure Active Directory authentication:
Ensure you’re authenticated with Azure CLI: az login

Azure AI Foundry

Project Client

Connect to your Azure AI Foundry project:

Chat Completions

Use the OpenAI-compatible client:

Streaming Responses

Get Project Connections

Foundry Local

Initialize Manager

List and Download Models

Model Management

Native Chat Completions

Start Web Server (Optional)

Azure AI Search

Search Client

Upload Documents

Azure Machine Learning

Workspace Client

Azure AI Services

Speech Recognition

Speech Synthesis

Content Safety

Error Handling

Async Best Practices

In library code, use ConfigureAwait(false) to avoid deadlocks:
Use using statements or IDisposable pattern:
Support cancellation for long-running operations:

Reduce Application Size

For Foundry Local, exclude large execution provider libraries:
Import in your .csproj:

Package References

REST API

Foundry REST API reference

Python SDK

Python SDK documentation

JavaScript SDK

JavaScript and TypeScript SDK

Samples

C# code samples on GitHub