Files
microsoft--agent-framework/declarative-agents
Ben Thomas 336a19fd32 .NET: .NET samples: migrate coding samples to Foundry-first AIProjectClient (#6557)
* Migrate 02-agents/Agents samples to AIProjectClient (Foundry)

Replace AzureOpenAIClient with AIProjectClient as the AI provider in all
02-agents/Agents samples, aligning with the Foundry-first approach.

Changes:
- 19 Program.cs files migrated to use AIProjectClient.AsAIAgent()
- 19 .csproj files updated (Azure.AI.OpenAI -> Microsoft.Agents.AI.Foundry)
- Environment variables: AZURE_OPENAI_* -> FOUNDRY_PROJECT_ENDPOINT/FOUNDRY_MODEL
- Updated description comments to reflect Foundry backend
- Provider-specific samples in AgentsWithFoundry/ intentionally unchanged

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

* Migrate 02-agents/AgentSkills, AgentWithMemory, AgentWithRAG, AgentOpenTelemetry to AIProjectClient

Replace AzureOpenAIClient with AIProjectClient as the AI provider.
Environment variables: AZURE_OPENAI_* -> FOUNDRY_PROJECT_ENDPOINT/FOUNDRY_MODEL.

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

* Migrate 03-workflows samples to AIProjectClient (Foundry)

Replace AzureOpenAIClient with AIProjectClient as the AI provider in
all 03-workflows samples that use an AI model.
Environment variables: AZURE_OPENAI_* -> FOUNDRY_PROJECT_ENDPOINT/FOUNDRY_MODEL.

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

* Fix PR 6557 build breaks and align Foundry client usage

- Add explicit Azure.Identity package references to migrated sample projects
  that use DefaultAzureCredential
- Fix AgentWithRAG_Step05_Neo4jGraphRAG to use AIProjectClient.AsAIAgent()
  with ChatOptions.ModelId instead of AIProjectClient.AsIChatClient()
- Keep migrated samples on AIProjectClient pattern (no FoundryAgent/AzureOpenAIClient)

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

* Address PR 6557 Foundry review follow-ups

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

* Fix post-rebase sample build and format regressions

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

* Updates to fix issues from switching to Responses.

* Fixing more tests and deleting checkpoint directories created for samples.

* Fixing formatting

* Restore DefaultAzureCredential warnings in agents samples

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

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-06-24 13:45:14 -07:00
..