# azd

Published articles for azd.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## 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.

## Using DefaultAzureCredential across multiple tenants

DevFeed: [Using DefaultAzureCredential across multiple tenants](<https://devfeed.tech/articles/using-defaultazurecredential-across-multiple-tenants-21731.md>)

Original publisher: [Read original article](<http://blog.pamelafox.org/2025/04/using-defaultazurecredential-across.html>)

Author: Pamela Fox (noreply@blogger.com)

Published: 2025-04-29T05:51:00Z

Content type: tutorial

Language: en

Sources: [Pamela Fox](<https://devfeed.tech/sources/pamela-fox.md>)

Topics: [Azure](<https://devfeed.tech/topics/azure.md>), [Authentication](<https://devfeed.tech/topics/authentication.md>), [SDKs](<https://devfeed.tech/topics/sdks.md>), [Command-line interface](<https://devfeed.tech/topics/cli.md>), [azd](<https://devfeed.tech/topics/azd.md>)

Tags: [authentication](<https://devfeed.tech/tags/authentication.md>), [azd](<https://devfeed.tech/tags/azd.md>), [azure](<https://devfeed.tech/tags/azure.md>), [cli](<https://devfeed.tech/tags/cli.md>), [python](<https://devfeed.tech/tags/python.md>), [sdk](<https://devfeed.tech/tags/sdk.md>)

### AI overview

This tutorial explains how to use DefaultAzureCredential when an Azure account is associated with multiple tenants. It presents two approaches: configuring the environment and active tenant, or selecting a specific credential and passing the desired tenant ID.

### Source excerpt

If you are using the DefaultAzureCredential class from the Azure Identity SDK while your user account is associated with multiple tenants, you may find yourself frequently running into API authentication errors (such as HTTP 401/Unauthorized). This post is for you! These are your two options for successful authentication from a non-default tenant: Setup your environment precisely to force DefaultAzureCredential to use the desired tenant Use a specific credential class and explicitly pass in the desired tenant ID Option 1: Get DefaultAzureCredential working The DefaultAzureCredential class is a credential chain, which means that it tries a sequence of credential classes until it finds one that can authenticate successfully. The current sequence is: EnvironmentCredential WorkloadIdentityCredential ManagedIdentityCredential SharedTokenCacheCredential AzureCliCredential AzurePowerShellCredential AzureDeveloperCliCredential InteractiveBrowserCredential For example, on my personal machine, only two of those credentials can retrieve tokens: AzureCliCredential: from logging in with Azure CLI (az login) AzureDeveloperCliCredential: from logging in with Azure Developer CLI (azd auth login) Many developers are logged in with those two credentials, so it's crucial to understand how this chained credential works. The AzureCliCredential is earlier in the chain, so if you are logged in with that, you must have the desired tenant set as the "active tenant". According to Azure CLI documentation, there are two ways to set the active tenant: az account set --subscription SUBSCRIPTION-ID where the subscription is from the desired tenant az login --tenant TENANT-ID, with no subsequent az login commands after Whatever option you choose, you can confirm that your desired tenant is currently the default by running az account show and verifying the tenantId in the account details shown. If you are only logged in with the azd CLI and not the Azure CLI, you have a problem: the azd cli does no