Azure AI Inference hosting integration
Ce contenu n’est pas encore disponible dans votre langue.
Although the Azure AI Inference library doesn’t currently offer direct hosting integration, you can still integrate it into your AppHost project. Simply add a connection string to establish a reference to an existing Azure AI Foundry resource.
For an introduction to working with the Azure AI Inference hosting integration, see Get started with the Azure AI Inference integrations.
Connect to an existing Azure AI Foundry service
Section titled “Connect to an existing Azure AI Foundry service”If you already have an Azure AI Foundry service, you can easily connect to it by adding a connection string to your AppHost. This approach uses a simple, string-based configuration. To establish the connection, use the AddConnectionString method:
var builder = DistributedApplication.CreateBuilder(args);
var aiFoundry = builder.AddConnectionString("ai-foundry");
builder.AddProject<Projects.ExampleProject>() .WithReference(aiFoundry);
// After adding all resources, run the app...The connection string is configured in the AppHost’s configuration, typically under User Secrets, under the ConnectionStrings section:
{ "ConnectionStrings": { "ai-foundry": "Endpoint=https://{endpoint}/;DeploymentId={deploymentName}" }}For more information, see Add existing Azure resources with connection strings.