Skip to content

Conversation

@SergeyMenshykh
Copy link
Member

Motivation and Context

We got some feedback that customers are using other token credential types e.g. they may be using EnvironmentCredential. I think AzureCliCredential is the best option for us but possibly not for customers so we may want to consider changing this to DefaultCredential and providing a health warning on it's use.

Related item: #795

Copilot AI review requested due to automatic review settings February 11, 2026 18:22
@SergeyMenshykh SergeyMenshykh self-assigned this Feb 11, 2026
@SergeyMenshykh SergeyMenshykh moved this to In Progress in Agent Framework Feb 11, 2026
@markwallace-microsoft markwallace-microsoft added documentation Improvements or additions to documentation .NET labels Feb 11, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates all .NET sample code to use DefaultAzureCredential instead of AzureCliCredential for Azure authentication, addressing customer feedback that they use various credential types (e.g., EnvironmentCredential). The change enables samples to work with multiple authentication methods while maintaining backward compatibility with Azure CLI authentication.

Changes:

  • Replaced all instances of AzureCliCredential with DefaultAzureCredential across 100+ sample files
  • Added consistent WARNING comments to all credential instantiations explaining production considerations
  • Updated documentation in README files to reference DefaultAzureCredential where modified

Reviewed changes

Copilot reviewed 113 out of 113 changed files in this pull request and generated no comments.

Show a summary per file
File Description
dotnet/samples/Purview/AgentWithPurview/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/M365Agent/README.md Updated documentation to reference DefaultAzureCredential
dotnet/samples/M365Agent/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/HostedAgents/AgentsInWorkflows/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/HostedAgents/AgentWithTextSearchRag/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/HostedAgents/AgentWithHostedMCP/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Workflows/_Foundational/08_WriterCriticWorkflow/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Workflows/_Foundational/07_MixedWorkflowAgentsAndExecutors/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Workflows/_Foundational/04_AgentWorkflowPatterns/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Workflows/_Foundational/03_AgentsInWorkflows/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Workflows/Observability/WorkflowAsAnAgent/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Workflows/Declarative/ToolApproval/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Workflows/Declarative/StudentTeacher/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Workflows/Declarative/Marketing/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Workflows/Declarative/InputArguments/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Workflows/Declarative/HostedWorkflow/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Workflows/Declarative/FunctionTools/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Workflows/Declarative/ExecuteWorkflow/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Workflows/Declarative/ExecuteCode/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Workflows/Declarative/DeepResearch/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Workflows/Declarative/CustomerSupport/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Workflows/ConditionalEdges/03_MultiSelection/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Workflows/ConditionalEdges/02_SwitchCase/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Workflows/ConditionalEdges/01_EdgeCondition/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Workflows/Concurrent/Concurrent/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Workflows/Agents/WorkflowAsAnAgent/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Workflows/Agents/GroupChatToolApproval/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Workflows/Agents/FoundryAgent/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Workflows/Agents/CustomAgentExecutors/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/ModelContextProtocol/ResponseAgent_Hosted_MCP/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/ModelContextProtocol/FoundryAgent_Hosted_MCP/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/ModelContextProtocol/Agent_MCP_Server_Auth/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/ModelContextProtocol/Agent_MCP_Server/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step27_LocalMCP/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step15_ComputerUse/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step14_CodeInterpreter/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step13_Plugins/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step12_Middleware/README.md Updated documentation to reference DefaultAzureCredential
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step12_Middleware/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step11_AsFunctionTool/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step10_UsingImages/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step09_UsingMcpClientAsTools/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step08_DependencyInjection/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step07_Observability/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step06_PersistedConversations/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step05_StructuredOutput/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step04_UsingFunctionToolsWithApprovals/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step03_UsingFunctionTools/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step02_MultiturnConversation/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step01.2_Running/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Step01.1_Basics/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/DevUI/DevUI_Step01_BasicUsage/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/DeclarativeAgents/ChatClient/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Agents/Agent_Step20_AdditionalAIContext/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Agents/Agent_Step19_Declarative/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Agents/Agent_Step18_DeepResearch/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Agents/Agent_Step17_BackgroundResponses/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Agents/Agent_Step16_ChatReduction/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Agents/Agent_Step15_Plugins/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Agents/Agent_Step14_Middleware/README.md Updated documentation to reference DefaultAzureCredential
dotnet/samples/GettingStarted/Agents/Agent_Step14_Middleware/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Agents/Agent_Step13_BackgroundResponsesWithToolsAndPersistence/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Agents/Agent_Step12_AsFunctionTool/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Agents/Agent_Step11_UsingImages/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Agents/Agent_Step10_AsMcpTool/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Agents/Agent_Step09_DependencyInjection/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Agents/Agent_Step08_Observability/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Agents/Agent_Step07_3rdPartyChatHistoryStorage/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Agents/Agent_Step06_PersistedConversations/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Agents/Agent_Step05_StructuredOutput/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Agents/Agent_Step04_UsingFunctionToolsWithApprovals/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Agents/Agent_Step03_UsingFunctionTools/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Agents/Agent_Step02_MultiturnConversation/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/Agents/Agent_Step01_Running/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step04_FoundryServiceRAG/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step03_CustomRAGDataSource/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step02_CustomVectorStoreRAG/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/AgentWithRAG/AgentWithRAG_Step01_BasicTextRAG/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/AgentWithMemory/AgentWithMemory_Step03_CustomMemory/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/AgentWithMemory/AgentWithMemory_Step02_MemoryUsingMem0/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/AgentWithMemory/AgentWithMemory_Step01_ChatHistoryMemory/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureOpenAIResponses/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureOpenAIChatCompletion/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureFoundryModel/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureAIProject/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/AgentProviders/Agent_With_AzureAIAgentsPersistent/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/AgentProviders/Agent_With_Anthropic/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/AgentOpenTelemetry/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/AGUI/Step05_StateManagement/Server/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/AGUI/Step04_HumanInLoop/Server/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/AGUI/Step03_FrontendTools/Server/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/AGUI/Step02_BackendTools/Server/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/AGUI/Step01_GettingStarted/Server/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/GettingStarted/A2A/A2AAgent_AsFunctionTools/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/Durable/Agents/ConsoleApps/07_ReliableStreaming/Program.cs Updated conditional to use DefaultAzureCredential with warning comment
dotnet/samples/Durable/Agents/ConsoleApps/06_LongRunningTools/Program.cs Updated conditional to use DefaultAzureCredential with warning comment
dotnet/samples/Durable/Agents/ConsoleApps/05_AgentOrchestration_HITL/Program.cs Updated conditional to use DefaultAzureCredential with warning comment
dotnet/samples/Durable/Agents/ConsoleApps/04_AgentOrchestration_Conditionals/Program.cs Updated conditional to use DefaultAzureCredential with warning comment
dotnet/samples/Durable/Agents/ConsoleApps/03_AgentOrchestration_Concurrency/Program.cs Updated conditional to use DefaultAzureCredential with warning comment
dotnet/samples/Durable/Agents/ConsoleApps/02_AgentOrchestration_Chaining/Program.cs Updated conditional to use DefaultAzureCredential with warning comment
dotnet/samples/Durable/Agents/ConsoleApps/01_SingleAgent/Program.cs Updated conditional to use DefaultAzureCredential with warning comment
dotnet/samples/Durable/Agents/AzureFunctions/08_ReliableStreaming/Program.cs Updated conditional to use DefaultAzureCredential with warning comment
dotnet/samples/Durable/Agents/AzureFunctions/07_AgentAsMcpTool/Program.cs Updated conditional to use DefaultAzureCredential with warning comment
dotnet/samples/Durable/Agents/AzureFunctions/06_LongRunningTools/Program.cs Updated conditional to use DefaultAzureCredential with warning comment
dotnet/samples/Durable/Agents/AzureFunctions/05_AgentOrchestration_HITL/Program.cs Updated conditional to use DefaultAzureCredential with warning comment
dotnet/samples/Durable/Agents/AzureFunctions/04_AgentOrchestration_Conditionals/Program.cs Updated conditional to use DefaultAzureCredential with warning comment
dotnet/samples/Durable/Agents/AzureFunctions/03_AgentOrchestration_Concurrency/Program.cs Updated conditional to use DefaultAzureCredential with warning comment
dotnet/samples/Durable/Agents/AzureFunctions/02_AgentOrchestration_Chaining/Program.cs Updated conditional to use DefaultAzureCredential with warning comment
dotnet/samples/Durable/Agents/AzureFunctions/01_SingleAgent/Program.cs Updated conditional to use DefaultAzureCredential with warning comment
dotnet/samples/AGUIWebChat/Server/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/AGUIClientServer/AGUIServer/Program.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/AGUIClientServer/AGUIDojoServer/ChatClientAgentFactory.cs Updated to use DefaultAzureCredential with warning comment
dotnet/samples/A2AClientServer/A2AServer/HostAgentFactory.cs Updated to use DefaultAzureCredential with warning comment

@SergeyMenshykh SergeyMenshykh moved this from In Progress to In Review in Agent Framework Feb 12, 2026
@SergeyMenshykh SergeyMenshykh added this pull request to the merge queue Feb 12, 2026
Merged via the queue into microsoft:main with commit 6000b73 Feb 12, 2026
15 checks passed
@github-project-automation github-project-automation bot moved this from In Review to Done in Agent Framework Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation .NET

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants