Gå til indhold

Get started with the Azure AI Foundry integrations

Dette indhold er ikke tilgængeligt i dit sprog endnu.

Azure AI Foundry logo 🧪 Preview

Azure AI Foundry provides a unified platform for developing, testing, and deploying AI applications. The Aspire Azure AI Foundry integration enables you to connect to Azure AI 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 Azure AI Foundry integrations in a simple configuration. If you already have this knowledge, see Azure AI Foundry Hosting integration for full reference details.

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

Aspire CLI — Tilføj Aspire.Hosting.Azure.AIFoundry-pakke
aspire add azure-aifoundry

Aspire CLI er interaktiv; vælg det passende søgeresultat når du bliver spurgt:

Aspire CLI — Eksempel output
Select an integration to add:
> azure-aifoundry (Aspire.Hosting.Azure.AIFoundry)
> Other results listed as selectable options...

Next, in the AppHost project, create an Azure AI Foundry resource and pass it to the consuming client projects:

C# — AppHost.cs
var builder = DistributedApplication.CreateBuilder(args);
var foundry = builder.AddAzureAIFoundry("foundry");
var chat = foundry.AddDeployment("chat", "Phi-4", "1", "Microsoft");
builder.AddProject<Projects.ExampleProject>()
.WithReference(chat)
.WaitFor(chat);
// After adding all resources, run the app...
builder.Build().Run();

The preceding code adds an Azure AI Foundry resource named foundry with a deployment named chat using the Phi-4 model to the AppHost project. The WithReference method passes the connection information to the ExampleProject project.

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.