# From dotnet run to Foundry Hosted Agent in 3 lines of C#

DevFeed: [From dotnet run to Foundry Hosted Agent in 3 lines of C#](<https://devfeed.tech/articles/from-dotnet-run-to-foundry-hosted-agent-in-3-lines-of-c-2950.md>)

Original publisher: [Read original article](<https://devblogs.microsoft.com/dotnet/from-dotnet-run-to-foundry-hosted-agent-in-3-lines-of-csharp/>)

Author: Bruno Capuano

Published: 2026-08-24T19:00:00Z

Content type: tutorial

Language: en

Sources: [.NET Blog](<https://devfeed.tech/sources/net-blog.md>)

Topics: [hosted-agents](<https://devfeed.tech/topics/hosted-agents.md>), [Microsoft Agent Framework](<https://devfeed.tech/topics/microsoft-agent-framework.md>), [Azure](<https://devfeed.tech/topics/azure.md>), [C#](<https://devfeed.tech/topics/csharp.md>), [.NET](<https://devfeed.tech/topics/net.md>), [NuGet](<https://devfeed.tech/topics/nuget.md>), [Entra ID](<https://devfeed.tech/topics/entra-id.md>), [Containers](<https://devfeed.tech/topics/containers.md>), [telemetry](<https://devfeed.tech/topics/telemetry.md>)

Tags: [agent](<https://devfeed.tech/tags/agent.md>), [agents](<https://devfeed.tech/tags/agents.md>), [ai](<https://devfeed.tech/tags/ai.md>), [azd](<https://devfeed.tech/tags/azd.md>), [azure](<https://devfeed.tech/tags/azure.md>), [blog](<https://devfeed.tech/tags/blog.md>), [c-sharp](<https://devfeed.tech/tags/c-sharp.md>), [csharp](<https://devfeed.tech/tags/csharp.md>), [dotnet](<https://devfeed.tech/tags/dotnet.md>), [entra-id](<https://devfeed.tech/tags/entra-id.md>), [framework](<https://devfeed.tech/tags/framework.md>), [hosted-agents](<https://devfeed.tech/tags/hosted-agents.md>), [hosting](<https://devfeed.tech/tags/hosting.md>), [infrastructure](<https://devfeed.tech/tags/infrastructure.md>), [microsoft](<https://devfeed.tech/tags/microsoft.md>), [microsoft-agent-framework](<https://devfeed.tech/tags/microsoft-agent-framework.md>), [microsoft-foundry](<https://devfeed.tech/tags/microsoft-foundry.md>), [net](<https://devfeed.tech/tags/net.md>), [nuget](<https://devfeed.tech/tags/nuget.md>), [observability](<https://devfeed.tech/tags/observability.md>), [post](<https://devfeed.tech/tags/post.md>), [production](<https://devfeed.tech/tags/production.md>)

## AI overview

This tutorial shows how to deploy a Microsoft Agent Framework console agent as a Foundry Hosted Agent using one NuGet package, three lines of C#, and two commands. Foundry provides managed Azure infrastructure, scaling, identity, session state, observability, and lifecycle management.

## Source excerpt

You built an agent with Microsoft Agent Framework and it works great on your machine. Now what? Turns out deploying it to production takes 1 NuGet package, 3 lines of C#, and 2 commands. Let's do it. The post From dotnet run to Foundry Hosted Agent in 3 lines of C# appeared first on .NET Blog.