Implement generative AI and agentic solutions 2.1 Build generative applications by using Foundry
A Python app uses the Azure AI Projects SDK to work with agents in a Foundry project…
Study guide skill: Configure an application to connect to a Foundry project
Question B1-016
A Python app uses the Azure AI Projects SDK to work with agents in a Foundry project, using keyless authentication. What do you pass to AIProjectClient?
Select one answer.
Answer: B
Foundry SDK samples create the client with the project endpoint, which has the form https://<account>.services.ai.azure.com/api/projects/<project>, and a token credential such as DefaultAzureCredential. Subscription details, a storage connection string or a bare Azure OpenAI endpoint don't identify the project.
Deep dive
How it works
The Foundry SDK (azure-ai-projects in Python) is a thin client over the Foundry project APIs, and everything it does is scoped to a project. So the client needs two things: where the project lives, and who you are.
- The project endpoint, in the form https://<resource-name>.services.ai.azure.com/api/projects/<project-name>.
- A token credential for keyless Microsoft Entra ID authentication, typically DefaultAzureCredential.
The samples on Microsoft Learn all follow the same shape: project = AIProjectClient(endpoint=project_endpoint, credential=DefaultAzureCredential()), then project.get_openai_client().
From there, the project client gives you an OpenAI-compatible client for responses, files and vector stores, plus agents, evaluations and the other Foundry-specific features. The SDK overview's guidance is to use the Foundry SDK when building apps with agents, evaluations, or Foundry-specific features.
The other options, and when you'd use them
- Subscription ID, resource group and an API key: AIProjectClient takes an endpoint and a credential, not subscription coordinates. The samples on the SDK overview page use Microsoft Entra ID through DefaultAzureCredential, and keys apply to the OpenAI-compatible endpoint instead.
- A connection string from the project's storage account: The client is created from the project endpoint. A storage connection string doesn't identify the project or authenticate you to it.
- The Azure OpenAI endpoint and the deployment name only: The https://<resource-name>.openai.azure.com/openai/v1 endpoint belongs to the OpenAI SDK, for the full OpenAI API surface. It doesn't provide access to Foundry-specific features such as agents.
Exam tip
AIProjectClient = project endpoint (.../api/projects/<project>) + DefaultAzureCredential. The openai.azure.com endpoint is for the plain OpenAI SDK.
References
Microsoft Learn references
Last reviewed: