Skip to main content

How to Find the Endpoint of a Microsoft Foundry Project with the Azure CLI

· 4 min read
Jagdish Kumawat
Founder @ Dewiride

Every app that talks to a Microsoft Foundry project needs the project's endpoint: the Foundry SDK, Microsoft Agent Framework and the Responses API all start from it. The Azure CLI prints it with one command, without opening the Foundry portal.

Syntax​

Syntax
az cognitiveservices account project show --resource-group <resource group> --name <foundry resource> --project-name <project> --query "properties.endpoints" --output json
PartWhat it is
az cognitiveservices account project showReturns a Cognitive Services project specified by the parameters, in the CLI's own words. A Foundry resource is a Cognitive Services account, and its projects belong to it
<resource group>The resource group of the Foundry resource
<foundry resource>The name of the Foundry resource
<project>The name of the project
--query "properties.endpoints"Picks the project's endpoints out of everything the command returns
--output jsonPrints them as JSON

To see every project of a resource with its endpoint, az cognitiveservices account project list --resource-group <resource group> --name <foundry resource> --query "[].properties.endpoints" --output json does the same for all of them.

The Example​

The Foundry resource foundry-devblogs-exp, in the resource group rg-devblogs-exp, has a project called proj-devblogs-exp. The command prints its endpoint.

Prerequisites​

  • The Azure CLI, signed in with az login, with an account that can read the Foundry resource.

Step 1: Print the Endpoint​

Run the command, with your own resource group, resource and project:

Terminal
az cognitiveservices account project show --resource-group rg-devblogs-exp --name foundry-devblogs-exp --project-name proj-devblogs-exp --query "properties.endpoints" --output json
Output
{
"AI Foundry API": "https://foundry-devblogs-exp.services.ai.azure.com/api/projects/proj-devblogs-exp"
}

macOS-style terminal window showing az cognitiveservices account project show for the project proj-devblogs-exp printing one endpoint, AI Foundry API, https://foundry-devblogs-exp.services.ai.azure.com/api/projects/proj-devblogs-exp

The value labeled AI Foundry API is the project endpoint. It has a fixed shape: https://<foundry resource>.services.ai.azure.com/api/projects/<project>.

Step 2: Use It in Your Code​

Pass it wherever an SDK asks for the project endpoint. With the Foundry SDK in C#, for example:

Program.cs
AIProjectClient project = new(
new Uri("https://foundry-devblogs-exp.services.ai.azure.com/api/projects/proj-devblogs-exp"),
new AzureCliCredential());

Why the Project Endpoint​

A Foundry resource has its own address too, without /api/projects/..., and some calls work there. Microsoft's Responses API quickstart explains what you'd miss: calling the project endpoint, not a resource-level OpenAI endpoint, unlocks these project-scoped capabilities, which include project-scoped data, Foundry's own tools, and project-level observability and governance. Use the project endpoint unless a guide asks for the resource's.

Common Mistakes​

MistakeWhat happensDo this instead
Using the resource's address, without /api/projects/<project>Project features aren't availableUse the endpoint from this command
Passing the project's name to --nameThe CLI looks for a Foundry resource with that name--name is the resource; the project goes in --project-name
Leaving out --queryThe command prints the project's full detailsAdd --query "properties.endpoints"

FAQ​

Where is the same endpoint in the Foundry portal?​

Microsoft's quickstart for hosted agents says to copy the Project endpoint from Home, the project's home page in the portal.

Is the endpoint a secret?​

No. It's an address: calling it still needs a token for an account with a role on the resource, such as Foundry User.

Conclusion​

az cognitiveservices account project show with --query "properties.endpoints" prints a Foundry project's endpoint, the address that ends in /api/projects/<project>. That's the address to pass to the Foundry SDK and Microsoft Agent Framework.

Additional Resources​