.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
- Windows (WinML)
- Cross-Platform
Azure AI Search
Azure Machine Learning
Authentication
All SDKs support Azure Active Directory authentication:Ensure you’re authenticated with Azure CLI:
az loginAzure 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
Full-Text Search
Vector Search
Upload Documents
Azure Machine Learning
Workspace Client
Azure AI Services
Speech Recognition
Speech Synthesis
Content Safety
Error Handling
Async Best Practices
Use ConfigureAwait(false)
Use ConfigureAwait(false)
In library code, use
ConfigureAwait(false) to avoid deadlocks:Dispose Resources
Dispose Resources
Use
using statements or IDisposable pattern:Cancellation Tokens
Cancellation Tokens
Support cancellation for long-running operations:
Reduce Application Size
For Foundry Local, exclude large execution provider libraries:.csproj:
Package References
Related Resources
REST API
Foundry REST API reference
Python SDK
Python SDK documentation
JavaScript SDK
JavaScript and TypeScript SDK
Samples
C# code samples on GitHub