Files
Ben Thomas c79f886dc3 .NET: Align Foundry sample environment variables and credentials. (#6422)
* dotnet: refresh Foundry sample guidance

Carry forward the still-relevant sample guidance and Foundry-specific documentation fixes from the old stacked sample migration work, adapted to the current repo layout and policy.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* dotnet: rename Foundry sample env vars

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* dotnet: remove persistent provider sample

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* dotnet: drop SAMPLE_GUIDELINES.md from this PR

Defer the guidelines doc and its cross-link to a follow-on PR to avoid broken-link failures in CI.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* dotnet: add DefaultAzureCredential warning to remaining samples

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* dotnet: address PR review feedback

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
c79f886dc3 · 2026-06-11 17:26:00 +00:00
History
..

Hosted-Toolbox

A hosted Foundry agent that loads tools from a Foundry Toolbox via the AF Foundry hosting bridge.

The agent declares one FoundryAITool.CreateHostedMcpToolbox(name) marker; AddFoundryToolboxes(name) registers a FoundryToolboxService that resolves the marker into the individual MCP tools the toolbox bundles, connecting to the Foundry Toolboxes MCP proxy at startup and discovering tools via tools/list.

Prerequisites

  • A Microsoft Foundry project with a Toolbox configured.
  • Azure CLI logged in (az login).
  • Set environment variables:
    • AZURE_AI_PROJECT_ENDPOINT (local-dev) or FOUNDRY_PROJECT_ENDPOINT (auto-injected in hosted containers)
    • AZURE_AI_MODEL_DEPLOYMENT_NAME (default gpt-4o)
    • TOOLBOX_NAME (default my-toolbox)

The Foundry.Hosting package builds the toolbox proxy URL from FOUNDRY_PROJECT_ENDPOINT as {FOUNDRY_PROJECT_ENDPOINT}/toolboxes/{TOOLBOX_NAME}/mcp?api-version=v1 per tools-integration-spec.md §2–§3.

Run

dotnet run --tl:off
  • Hosted-Toolbox-AuthPaths/ — extends this pattern with a three-tool toolbox demonstrating different MCP-tool authentication paths (key, Entra agent identity, inline Authorization), driven by the shared Using-Samples/SimpleAgent/ REPL.
  • Hosted-McpTools/ — contrasts client-side McpClient vs server-side HostedMcpServerTool for non-toolbox MCP servers.