Skill 2.1.6

Configure an application to connect to a Foundry project

Key Concepts

The project endpoint has the form https://<resource>.services.ai.azure.com/api/projects/<project>. The application reads it from configuration (an environment variable or Azure App Configuration) and creates AIProjectClient(endpoint=..., credential=DefaultAzureCredential()). Locally, DefaultAzureCredential uses the developer's Azure CLI or Visual Studio Code sign-in; in Azure it uses the hosting service's managed identity.

The identity needs a role on the project or resource, such as Foundry User, and roles on any other resources it calls directly, such as Search Index Data Reader on Azure AI Search. Resources that the project reaches on the application's behalf are configured once as project connections, ideally using Microsoft Entra ID rather than stored keys. When keys are unavoidable for a third-party service, they are kept in Azure Key Vault and never in code or source control.