.NET: Migrate remaining Foundry hosted samples to source deployment - #7668
.NET: Migrate remaining Foundry hosted samples to source deployment#7668Roger Barreto (rogerbarreto) wants to merge 7 commits into
Conversation
Extend the source (ZIP) deploy pattern established for Hosted-ChatClientAgent to Hosted-LocalTools, Hosted-Workflow-Simple, Hosted-TextRag, Hosted-Observability, Hosted-Files and Hosted-FoundryAgent. Each gains an azure.yaml (codeConfiguration/remote_build, ASPNETCORE_URLS, model env) and the canonical .agentignore, a self-contained csproj (single target, CPM opt-out, explicit published package versions, AgentFrameworkVersion), a Program.cs that drops the shared contributor scaffolding for DefaultAzureCredential, an updated .env.example and README, and drops the container-mode files (agent.yaml, agent.manifest.yaml, Dockerfile, Dockerfile.contributor). LocalTools, Workflow-Simple, TextRag, Observability and Files were verified deploying live via remote_build; Workflow-Simple returns a workflow runtime error at invoke that is unrelated to the deploy mode.
… source (ZIP) deploy EchoAgent (Invocations protocol) and LocalCodeAct migrated to the zip/code-deploy pattern (azure.yaml, .agentignore, self-contained csproj, README, container files removed). EchoAgent maps /readiness explicitly because the Invocations SDK does not auto-map it. Both verified live via remote_build on a Foundry project; LocalCodeAct's execute_code ran server-side (compute 21+21 -> 42).
Migrate Hosted-McpTools, Hosted-MemoryAgent, Hosted-AgentSkills, Hosted-AzureSearchRag, Hosted-Toolbox, Hosted-Toolbox-AuthPaths and Hosted-ToolboxMcpSkills to the zip/code-deploy pattern (azure.yaml with codeConfiguration + sample-specific env passthrough, canonical .agentignore, self-contained csproj, Program.cs dropping the shared contributor scaffolding for DefaultAzureCredential, updated .env.example and README, container files removed). Also restore the Hosted-Invocations-EchoAgent csproj filename the solution references. McpTools verified live via remote_build against the public Microsoft Learn MCP server; the memory/search/toolbox/skills samples build locally and deploy via remote_build but need their external resources (memory store, search index, toolbox connections, skills) provisioned to exercise end to end.
Migrate the triage handoff workflow sample to the zip/code-deploy pattern (azure.yaml with codeConfiguration and Azure OpenAI env passthrough, canonical .agentignore, self-contained csproj using AgentFrameworkVersion for Foundry/Foundry.Hosting/Hosting, Program.cs dropping the shared contributor scaffolding for DefaultAzureCredential, updated .env.example and README, container files removed). Builds via remote_build; live needs an Azure OpenAI resource (AZURE_OPENAI_ENDPOINT/AZURE_OPENAI_DEPLOYMENT).
The startup provisioning helper reads SKILL.md files from AppContext.BaseDirectory/skills, but the project did not copy the skills/ folder to the build/publish output, so at runtime the source directory did not exist and provisioning was silently skipped. Add a Content include (PreserveNewest), matching the resources/ pattern already used by Hosted-Files.
…P build The repo-wide Directory.Build.props suppresses OPENAI001, but that file does not travel in the code/ZIP deploy package. The standalone dotnet publish the Foundry code deploy runs then fails with error OPENAI001 on the experimental GetResponsesClient().AsIChatClient() call. Add OPENAI001 to the project NoWarn so the sample builds in the code-deploy pipeline, matching SimpleAgent.csproj.
…READMEs Align every FoundryHostedAgents sample README with the documented azd flow and add the idiosyncrasies found while live-testing each sample on a Foundry project: - All samples: 'azd down' reports success but does not delete the hosted agent; document the explicit REST DELETE needed to remove it. - Hosted-Workflow-Handoff: it builds its own AzureOpenAIClient (data-plane), so the agent identity needs the 'Cognitive Services OpenAI User' role on the Azure OpenAI account. azd only grants 'Foundry User' on the project, so add a step to grant the data-plane role and explain the triage-step failure without it. - Hosted-Toolbox / Toolbox-AuthPaths / ToolboxMcpSkills: the toolbox must already exist and the agent identity must be able to read it; toolboxes with OAuth-gated tools return an oauth_consent_request and response.incomplete on first invoke.
There was a problem hiding this comment.
Pull request overview
Migrates the remaining .NET Foundry hosted-agent samples from container-image deployment to source/ZIP deployment while retaining each scenario’s configuration and dependencies.
Changes:
- Adds unified
azure.yamlsource-deployment configurations and self-contained project files. - Removes obsolete Dockerfiles and split agent manifests; adds upload exclusions and updated setup guidance.
- Adds resource packaging and readiness fixes for Agent Skills and Invocations samples.
Reviewed changes
Copilot reviewed 163 out of 163 changed files in this pull request and generated 9 comments.
Show a summary per file
Base path: dotnet/samples/04-hosting/FoundryHostedAgents/
| File | Description |
|---|---|
responses/Hosted-Workflow-Simple/Program.cs |
Updates source-hosted configuration and authentication. |
responses/Hosted-Workflow-Simple/HostedWorkflowSimple.csproj |
Makes the ZIP project self-contained. |
responses/Hosted-Workflow-Simple/README.md |
Documents source deployment. |
responses/Hosted-Workflow-Simple/Dockerfile.contributor |
Removes contributor container deployment. |
responses/Hosted-Workflow-Simple/Dockerfile |
Removes image deployment. |
responses/Hosted-Workflow-Simple/azure.yaml |
Adds unified source deployment. |
responses/Hosted-Workflow-Simple/agent.yaml |
Removes obsolete agent definition. |
responses/Hosted-Workflow-Simple/agent.manifest.yaml |
Removes obsolete manifest. |
responses/Hosted-Workflow-Simple/.env.example |
Updates local configuration. |
responses/Hosted-Workflow-Simple/.agentignore |
Defines ZIP exclusions. |
responses/Hosted-Workflow-Handoff/Program.cs |
Updates hosted authentication. |
responses/Hosted-Workflow-Handoff/HostedWorkflowHandoff.csproj |
Adds standalone dependencies and warning settings. |
responses/Hosted-Workflow-Handoff/README.md |
Documents source deployment and Azure OpenAI permissions. |
responses/Hosted-Workflow-Handoff/Dockerfile.contributor |
Removes contributor container deployment. |
responses/Hosted-Workflow-Handoff/Dockerfile |
Removes image deployment. |
responses/Hosted-Workflow-Handoff/azure.yaml |
Adds unified source deployment. |
responses/Hosted-Workflow-Handoff/agent.yaml |
Removes obsolete agent definition. |
responses/Hosted-Workflow-Handoff/agent.manifest.yaml |
Removes obsolete manifest. |
responses/Hosted-Workflow-Handoff/.env.example |
Updates Azure OpenAI configuration. |
responses/Hosted-Workflow-Handoff/.agentignore |
Defines ZIP exclusions. |
responses/Hosted-ToolboxMcpSkills/Program.cs |
Updates credentials and hosted endpoints. |
responses/Hosted-ToolboxMcpSkills/HostedToolboxMcpSkills.csproj |
Adds standalone MCP dependencies. |
responses/Hosted-ToolboxMcpSkills/README.md |
Documents toolbox source deployment. |
responses/Hosted-ToolboxMcpSkills/Dockerfile.contributor |
Removes contributor container deployment. |
responses/Hosted-ToolboxMcpSkills/Dockerfile |
Removes image deployment. |
responses/Hosted-ToolboxMcpSkills/azure.yaml |
Adds toolbox source deployment. |
responses/Hosted-ToolboxMcpSkills/agent.yaml |
Removes obsolete agent definition. |
responses/Hosted-ToolboxMcpSkills/agent.manifest.yaml |
Removes obsolete manifest. |
responses/Hosted-ToolboxMcpSkills/.env.example |
Updates model and toolbox configuration. |
responses/Hosted-ToolboxMcpSkills/.agentignore |
Defines ZIP exclusions. |
responses/Hosted-Toolbox/Program.cs |
Updates credentials and configuration access. |
responses/Hosted-Toolbox/HostedToolbox.csproj |
Makes the ZIP project self-contained. |
responses/Hosted-Toolbox/README.md |
Documents toolbox deployment. |
responses/Hosted-Toolbox/Dockerfile.contributor |
Removes contributor container deployment. |
responses/Hosted-Toolbox/Dockerfile |
Removes image deployment. |
responses/Hosted-Toolbox/azure.yaml |
Adds toolbox source deployment. |
responses/Hosted-Toolbox/agent.yaml |
Removes obsolete agent definition. |
responses/Hosted-Toolbox/agent.manifest.yaml |
Removes obsolete manifest. |
responses/Hosted-Toolbox/.env.example |
Updates model and toolbox configuration. |
responses/Hosted-Toolbox/.agentignore |
Defines ZIP exclusions. |
responses/Hosted-Toolbox-AuthPaths/Program.cs |
Removes temporary-token support. |
responses/Hosted-Toolbox-AuthPaths/Hosted-Toolbox-AuthPaths.csproj |
Makes the ZIP project self-contained. |
responses/Hosted-Toolbox-AuthPaths/README.md |
Documents OAuth toolbox deployment. |
responses/Hosted-Toolbox-AuthPaths/Dockerfile.contributor |
Removes contributor container deployment. |
responses/Hosted-Toolbox-AuthPaths/Dockerfile |
Removes image deployment. |
responses/Hosted-Toolbox-AuthPaths/azure.yaml |
Adds OAuth toolbox source deployment. |
responses/Hosted-Toolbox-AuthPaths/agent.yaml |
Removes obsolete agent definition. |
responses/Hosted-Toolbox-AuthPaths/agent.manifest.yaml |
Removes obsolete manifest. |
responses/Hosted-Toolbox-AuthPaths/.env.example |
Updates local OAuth configuration. |
responses/Hosted-Toolbox-AuthPaths/.agentignore |
Defines ZIP exclusions. |
responses/Hosted-TextRag/Program.cs |
Updates model selection and authentication. |
responses/Hosted-TextRag/HostedTextRag.csproj |
Makes the ZIP project self-contained. |
responses/Hosted-TextRag/README.md |
Documents source deployment. |
responses/Hosted-TextRag/Dockerfile.contributor |
Removes contributor container deployment. |
responses/Hosted-TextRag/Dockerfile |
Removes image deployment. |
responses/Hosted-TextRag/azure.yaml |
Adds RAG source deployment. |
responses/Hosted-TextRag/agent.yaml |
Removes obsolete agent definition. |
responses/Hosted-TextRag/agent.manifest.yaml |
Removes obsolete manifest. |
responses/Hosted-TextRag/.env.example |
Updates local model configuration. |
responses/Hosted-TextRag/.agentignore |
Defines ZIP exclusions. |
responses/Hosted-Observability/Program.cs |
Updates source-hosted configuration. |
responses/Hosted-Observability/HostedObservability.csproj |
Makes the ZIP project self-contained. |
responses/Hosted-Observability/README.md |
Documents observable source deployment. |
responses/Hosted-Observability/Dockerfile.contributor |
Removes contributor container deployment. |
responses/Hosted-Observability/Dockerfile |
Removes image deployment. |
responses/Hosted-Observability/azure.yaml |
Adds telemetry-enabled source deployment. |
responses/Hosted-Observability/agent.yaml |
Removes obsolete agent definition. |
responses/Hosted-Observability/agent.manifest.yaml |
Removes obsolete manifest. |
responses/Hosted-Observability/.env.example |
Updates local configuration. |
responses/Hosted-Observability/.dockerignore |
Removes obsolete Docker exclusions. |
responses/Hosted-Observability/.agentignore |
Defines ZIP exclusions. |
responses/Hosted-MemoryAgent/Program.cs |
Updates memory and model configuration. |
responses/Hosted-MemoryAgent/HostedMemoryAgent.csproj |
Makes the ZIP project self-contained. |
responses/Hosted-MemoryAgent/README.md |
Documents memory deployment requirements. |
responses/Hosted-MemoryAgent/Dockerfile.contributor |
Removes contributor container deployment. |
responses/Hosted-MemoryAgent/Dockerfile |
Removes image deployment. |
responses/Hosted-MemoryAgent/azure.yaml |
Adds memory-agent source deployment. |
responses/Hosted-MemoryAgent/agent.yaml |
Removes obsolete agent definition. |
responses/Hosted-MemoryAgent/agent.manifest.yaml |
Removes obsolete manifest. |
responses/Hosted-MemoryAgent/.env.example |
Updates memory configuration. |
responses/Hosted-MemoryAgent/.agentignore |
Defines ZIP exclusions. |
responses/Hosted-McpTools/Program.cs |
Updates MCP source-hosted configuration. |
responses/Hosted-McpTools/HostedMcpTools.csproj |
Adds standalone MCP dependencies. |
responses/Hosted-McpTools/README.md |
Documents MCP source deployment. |
responses/Hosted-McpTools/Dockerfile.contributor |
Removes contributor container deployment. |
responses/Hosted-McpTools/Dockerfile |
Removes image deployment. |
responses/Hosted-McpTools/azure.yaml |
Adds MCP source deployment. |
responses/Hosted-McpTools/agent.yaml |
Removes obsolete agent definition. |
responses/Hosted-McpTools/agent.manifest.yaml |
Removes obsolete manifest. |
responses/Hosted-McpTools/.env.example |
Updates model configuration. |
responses/Hosted-McpTools/.agentignore |
Defines ZIP exclusions. |
responses/Hosted-LocalTools/Program.cs |
Updates model selection and hosting. |
responses/Hosted-LocalTools/HostedLocalTools.csproj |
Makes the ZIP project self-contained. |
responses/Hosted-LocalTools/README.md |
Documents local-tools deployment. |
responses/Hosted-LocalTools/Dockerfile.contributor |
Removes contributor container deployment. |
responses/Hosted-LocalTools/Dockerfile |
Removes image deployment. |
responses/Hosted-LocalTools/azure.yaml |
Adds local-tools source deployment. |
responses/Hosted-LocalTools/agent.yaml |
Removes obsolete agent definition. |
responses/Hosted-LocalTools/agent.manifest.yaml |
Removes obsolete manifest. |
responses/Hosted-LocalTools/.env.example |
Updates model configuration. |
responses/Hosted-LocalTools/.agentignore |
Defines ZIP exclusions. |
responses/Hosted-LocalCodeAct/Program.cs |
Updates CodeAct source-hosted configuration. |
responses/Hosted-LocalCodeAct/HostedLocalCodeAct.csproj |
Adds standalone CodeAct dependencies. |
responses/Hosted-LocalCodeAct/README.md |
Documents CodeAct source deployment. |
responses/Hosted-LocalCodeAct/Dockerfile.contributor |
Removes Python-enabled contributor image. |
responses/Hosted-LocalCodeAct/Dockerfile |
Removes Python-enabled image deployment. |
responses/Hosted-LocalCodeAct/azure.yaml |
Adds CodeAct source deployment. |
responses/Hosted-LocalCodeAct/agent.yaml |
Removes obsolete agent definition. |
responses/Hosted-LocalCodeAct/agent.manifest.yaml |
Removes obsolete manifest. |
responses/Hosted-LocalCodeAct/.env.example |
Updates local configuration. |
responses/Hosted-LocalCodeAct/.agentignore |
Defines ZIP exclusions. |
responses/Hosted-FoundryAgent/Program.cs |
Updates managed-agent hosting credentials. |
responses/Hosted-FoundryAgent/HostedFoundryAgent.csproj |
Makes the ZIP project self-contained. |
responses/Hosted-FoundryAgent/README.md |
Documents managed-agent deployment. |
responses/Hosted-FoundryAgent/Dockerfile.contributor |
Removes contributor container deployment. |
responses/Hosted-FoundryAgent/Dockerfile |
Removes image deployment. |
responses/Hosted-FoundryAgent/azure.yaml |
Adds managed-agent source deployment. |
responses/Hosted-FoundryAgent/agent.yaml |
Removes obsolete agent definition. |
responses/Hosted-FoundryAgent/agent.manifest.yaml |
Removes obsolete manifest. |
responses/Hosted-FoundryAgent/.env.example |
Updates local authentication settings. |
responses/Hosted-FoundryAgent/.agentignore |
Defines ZIP exclusions. |
responses/Hosted-Files/Program.cs |
Updates file roots and authentication. |
responses/Hosted-Files/HostedFiles.csproj |
Packages bundled files for publishing. |
responses/Hosted-Files/README.md |
Documents bundled/session-file deployment. |
responses/Hosted-Files/Dockerfile.contributor |
Removes contributor container deployment. |
responses/Hosted-Files/Dockerfile |
Removes image deployment. |
responses/Hosted-Files/azure.yaml |
Adds files-agent source deployment. |
responses/Hosted-Files/agent.yaml |
Removes obsolete agent definition. |
responses/Hosted-Files/agent.manifest.yaml |
Removes obsolete manifest. |
responses/Hosted-Files/.env.example |
Updates model configuration. |
responses/Hosted-Files/.dockerignore |
Removes obsolete Docker exclusions. |
responses/Hosted-Files/.agentignore |
Defines ZIP exclusions. |
responses/Hosted-AzureSearchRag/Program.cs |
Updates Search authentication and model settings. |
responses/Hosted-AzureSearchRag/HostedAzureSearchRag.csproj |
Adds standalone Search dependencies. |
responses/Hosted-AzureSearchRag/README.md |
Documents Search deployment requirements. |
responses/Hosted-AzureSearchRag/Dockerfile.contributor |
Removes contributor container deployment. |
responses/Hosted-AzureSearchRag/Dockerfile |
Removes image deployment. |
responses/Hosted-AzureSearchRag/azure.yaml |
Adds Search RAG source deployment. |
responses/Hosted-AzureSearchRag/agent.yaml |
Removes obsolete agent definition. |
responses/Hosted-AzureSearchRag/agent.manifest.yaml |
Removes obsolete manifest. |
responses/Hosted-AzureSearchRag/.env.example |
Updates Search configuration. |
responses/Hosted-AzureSearchRag/.agentignore |
Defines ZIP exclusions. |
responses/Hosted-AgentSkills/Program.cs |
Updates skill provisioning authentication. |
responses/Hosted-AgentSkills/HostedAgentSkills.csproj |
Packages bundled skill resources. |
responses/Hosted-AgentSkills/README.md |
Documents skills deployment. |
responses/Hosted-AgentSkills/Dockerfile.contributor |
Removes contributor container deployment. |
responses/Hosted-AgentSkills/Dockerfile |
Removes image deployment. |
responses/Hosted-AgentSkills/azure.yaml |
Adds skills source deployment. |
responses/Hosted-AgentSkills/agent.yaml |
Removes obsolete agent definition. |
responses/Hosted-AgentSkills/agent.manifest.yaml |
Removes obsolete manifest. |
responses/Hosted-AgentSkills/.env.example |
Updates skill configuration. |
responses/Hosted-AgentSkills/.agentignore |
Defines ZIP exclusions. |
invocations/Hosted-Invocations-EchoAgent/Program.cs |
Adds the required readiness endpoint. |
invocations/Hosted-Invocations-EchoAgent/Hosted-Invocations-EchoAgent.csproj |
Makes the ZIP project self-contained. |
invocations/Hosted-Invocations-EchoAgent/README.md |
Documents Invocations source deployment. |
invocations/Hosted-Invocations-EchoAgent/Dockerfile.contributor |
Removes contributor container deployment. |
invocations/Hosted-Invocations-EchoAgent/Dockerfile |
Removes image deployment. |
invocations/Hosted-Invocations-EchoAgent/azure.yaml |
Adds Invocations source deployment. |
invocations/Hosted-Invocations-EchoAgent/agent.yaml |
Removes obsolete agent definition. |
invocations/Hosted-Invocations-EchoAgent/agent.manifest.yaml |
Removes obsolete manifest. |
invocations/Hosted-Invocations-EchoAgent/.env.example |
Updates local port configuration. |
invocations/Hosted-Invocations-EchoAgent/.agentignore |
Defines ZIP exclusions. |
responses/Hosted-ChatClientAgent/README.md |
Documents explicit hosted-agent cleanup. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
| codeConfiguration: | ||
| dependencyResolution: remote_build | ||
| entryPoint: HostedLocalCodeAct.dll | ||
| runtime: dotnet_10 |
| ?? throw new InvalidOperationException("FOUNDRY_PROJECT_ENDPOINT is not set."); | ||
| var deployment = Environment.GetEnvironmentVariable("FOUNDRY_MODEL") ?? "gpt-5"; | ||
| var toolboxName = Environment.GetEnvironmentVariable("TOOLBOX_NAME") | ||
| var deployment = System.Environment.GetEnvironmentVariable("FOUNDRY_MODEL") ?? "gpt-5"; |
| // The Foundry-managed agent to wrap, by name. When hosted, the platform injects AGENT_NAME as this | ||
| // hosted agent's own name, so the hosted agent and the managed agent it wraps share a name. | ||
| var agentName = System.Environment.GetEnvironmentVariable("AGENT_NAME") | ||
| ?? throw new InvalidOperationException("AGENT_NAME is not set."); |
| env: | ||
| ASPNETCORE_URLS: http://+:8088 | ||
| AZURE_AI_MODEL_DEPLOYMENT_NAME: ${AZURE_AI_MODEL_DEPLOYMENT_NAME} | ||
| TOOLBOX_NAME: ${TOOLBOX_NAME} |
| env: | ||
| ASPNETCORE_URLS: http://+:8088 | ||
| AZURE_AI_MODEL_DEPLOYMENT_NAME: ${AZURE_AI_MODEL_DEPLOYMENT_NAME} | ||
| TOOLBOX_NAME: ${TOOLBOX_NAME} |
| AZURE_AI_MEMORY_STORE_ID: ${AZURE_AI_MEMORY_STORE_ID} | ||
| AZURE_AI_EMBEDDING_DEPLOYMENT_NAME: ${AZURE_AI_EMBEDDING_DEPLOYMENT_NAME} |
| AZURE_SEARCH_ENDPOINT: ${AZURE_SEARCH_ENDPOINT} | ||
| AZURE_SEARCH_INDEX_NAME: ${AZURE_SEARCH_INDEX_NAME} |
| SKILL_NAMES: ${SKILL_NAMES} | ||
| PROVISION_SAMPLE_SKILLS: ${PROVISION_SAMPLE_SKILLS} |
| env: | ||
| ASPNETCORE_URLS: http://+:8088 | ||
| AZURE_AI_MODEL_DEPLOYMENT_NAME: ${AZURE_AI_MODEL_DEPLOYMENT_NAME} | ||
| TOOLBOX_NAME: ${TOOLBOX_NAME} |
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: Findings reported
Scope: full PR (7 commit(s)): 9b166f0e7221, d95fda3970f8, f7bba0da05bd, 9f9aa7e4e103, d54c8b28bd2c, 88de4cd33c1f, 986d6510fce3
Model: gpt-5.6-sol
Overview
The migration consistently adopts source deployment, self-contained project metadata, explicit readiness behavior, upload exclusions, and sample-specific resource packaging. The remaining risks are concentrated in copy/paste deployment workflows: the Workflow Handoff guide configures and invokes the scaffold in the wrong lifecycle order, the contributor helper cannot restore all newly documented package closures, and cleanup commands expose bearer tokens in process arguments.
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
4 verified findings remained after source verification (4 medium) across 3 files. Details are attached to the affected lines below.
Affected areas: dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-FoundryAgent/README.md, dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalCodeAct/README.md, dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-Workflow-Handoff/README.md
| -d '{"input": "Write me a haiku about autumn", "model": "triage-workflow"}' | ||
| ``` | ||
| # Provide the Azure OpenAI settings to the azd environment before deploying: | ||
| azd env set AZURE_OPENAI_ENDPOINT https://<your-openai>.openai.azure.com/ |
There was a problem hiding this comment.
These settings are written before entering the project folder that azd ai agent init just scaffolded. Following the commands therefore does not configure that project's azd environment, so the manifest supplies blank OpenAI values and startup fails when constructing the endpoint URI. Enter hosted-workflow-handoff before setting these values, or explicitly target the scaffolded project/environment.
| cd hosted-workflow-handoff | ||
| azd provision | ||
| azd deploy | ||
| azd ai agent invoke "Write a haiku about the sea." |
There was a problem hiding this comment.
This invocation runs before the managed identity receives the Cognitive Services OpenAI User role, although the later section documents that the first model call fails without it. Move invocation after principal discovery, role assignment, and propagation so the primary copy/paste flow succeeds.
| azd ai agent init -m https://github.com/microsoft/agent-framework/blob/main/dotnet/samples/04-hosting/FoundryHostedAgents/responses/Hosted-LocalCodeAct/agent.manifest.yaml | ||
| ```powershell | ||
| cd $work | ||
| <repo>/dotnet/samples/04-hosting/FoundryHostedAgents/scripts/Add-LocalFrameworkFeed.ps1 -Path ./hosted-local-codeact |
There was a problem hiding this comment.
The documented helper maps every Microsoft.Agents.AI* dependency exclusively to local-feed, but its fixed package list omits Microsoft.Agents.AI.LocalCodeAct; the equivalent flows for Workflow Handoff and ToolboxMcpSkills also omit their Hosting and Mcp packages. Remote restore therefore fails for these newly migrated contributor deployments. Include each target project's complete Agent Framework package closure and repoint every locally packed package version.
| > ```bash | ||
| > TOKEN=$(az account get-access-token --resource https://ai.azure.com --query accessToken -o tsv) | ||
| > curl -X DELETE "<project-endpoint>/agents/hosted-foundry-agent?api-version=v1&force=true" \ | ||
| > -H "Authorization: Bearer $TOKEN" -H "Foundry-Features: HostedAgents=V1Preview" |
There was a problem hiding this comment.
Expanding the bearer token in this argument exposes it through curl's process command line, allowing another local user to capture and reuse the caller's Foundry credentials until expiry. The same cleanup pattern appears across the migrated guides. Apply authentication through a mechanism that does not place the token in argv, such as an authenticated Azure CLI request or a header read from protected stdin.
Motivation & Context
Source deployment, where Foundry receives a code or ZIP upload and builds it remotely, is now the default path for .NET hosted agents. PR #7372 established that path for
Hosted-ChatClientAgent, but the remaining samples still required Dockerfiles, container registry configuration, and older split agent manifests. This made the documented path more complex than the platform requires and left contributors using a different deployment path from end users.This change completes that migration across the remaining Foundry hosted agent samples while preserving the configuration, packaged resources, permissions, and external dependencies that are specific to each scenario.
Description & Review Guide
What are the major changes?
Migrates the remaining 16 hosted agent samples to one
azure.yamlwithcodeConfiguration, remotedotnet restoreanddotnet publish, and a generated.agentignore. Removes the source deployment Dockerfiles and splitagent.yamlandagent.manifest.yamlfiles.Makes every uploaded project self-contained because repository build configuration does not travel in the ZIP. Projects declare their target framework and package versions directly, opt out of central package management, and include required resources such as AgentSkills content in the published output.
Aligns every README with the same documented
azd ai agent init,azd provision,azd deploy, andazd ai agent invokeflow. Each README also documents its own model, search, memory, toolbox, OAuth consent, Azure OpenAI role, resource packaging, and cleanup requirements.Includes fixes found through standalone and live deployment testing, including the Invocations readiness endpoint, copying AgentSkills resources, and suppressing
OPENAI001inside the Workflow Handoff project because repository-wide warning settings are unavailable during remote ZIP builds.What is the impact of these changes?
End users can deploy these samples directly from source without authoring a container image or managing a registry. Contributors use the same flow with one optional step that places locally built Agent Framework packages inside the upload. Existing sample behavior and protocols remain unchanged.
What do you want reviewers to focus on?
Please focus on the consistency of each
azure.yamland self-contained project file, and on whether each README clearly distinguishes the common deployment flow from the sample-specific resources and permissions it requires.Related Issue
Fixes #7667
This is the continuation of merged PR #7372. No other open PR targets #7667.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.