Get started with the Microsoft Foundry integrations

Microsoft Foundry logo
🧪 Preview

Microsoft Foundry provides a unified platform for developing, testing, and deploying AI applications. The Aspire Microsoft Foundry integration enables you to connect to Microsoft Foundry services from your applications, providing access to various AI capabilities including model deployments, prompt flow, and more.

In this introduction, you'll see how to install and use the Aspire Microsoft Foundry integrations in a simple configuration. If you already have this knowledge, see Microsoft Foundry Hosting integration for full reference details.

Note

To follow this guide, you must have created an Aspire solution to work with. To learn how to do that, see Build your first Aspire app.

Set up hosting integration

To begin, install the Aspire Microsoft Foundry Hosting integration in your Aspire AppHost project. This integration allows you to create and manage Microsoft Foundry resources from your Aspire hosting projects:

Install the NuGet package
dotnet add package Aspire.Hosting.Foundry

Next, in the AppHost project, create a Microsoft Foundry resource and pass it to the consuming client projects:

var builder = DistributedApplication.CreateBuilder(args);
  
var foundry = builder.AddFoundry("foundry");
  
var chat = foundry.AddDeployment("chat", FoundryModel.OpenAI.Gpt5Mini);
  
builder.AddProject<Projects.ExampleProject>()
    .WithReference(chat)
    .WaitFor(chat);
  
// After adding all resources, run the app...
  
builder.Build().Run();

The preceding code adds a Microsoft Foundry resource named foundry with a deployment named chat using the generated FoundryModel.OpenAI.Gpt5Mini descriptor. The WithReference method passes the connection information to the ExampleProject project.

Caution

When you call AddFoundry, it implicitly calls AddAzureProvisioning—which adds support for generating Azure resources dynamically during app startup. The app must configure the appropriate subscription and location. For more information, see Local provisioning: Configuration.

Tip

This is the simplest implementation of Microsoft Foundry resources in the AppHost. There are many more options you can choose from to address your requirements. For full details, see Microsoft Foundry Hosting integration.

Set up client integration

The client integration for Azure AI Foundry is the Azure AI Inference integration. To use Azure AI Foundry from your client applications, install the Azure AI Inference integration in your client project.

For more information on using the client integration, see the Azure AI Inference integration documentation.

Next steps