From d6bd79fcb89a848f9f1fc0d27818eae2c60e078c Mon Sep 17 00:00:00 2001 From: SergeyMenshykh Date: Tue, 2 Jun 2026 10:31:33 +0100 Subject: [PATCH] Use AzureCliCredential in Foundry toolbox skills sample for consistency Replace DefaultAzureCredential with AzureCliCredential to match the credential convention used in all other samples. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../foundry/foundry_chat_client_with_toolbox_skills.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/python/samples/02-agents/providers/foundry/foundry_chat_client_with_toolbox_skills.py b/python/samples/02-agents/providers/foundry/foundry_chat_client_with_toolbox_skills.py index 4e41460341..73b9dd1e89 100644 --- a/python/samples/02-agents/providers/foundry/foundry_chat_client_with_toolbox_skills.py +++ b/python/samples/02-agents/providers/foundry/foundry_chat_client_with_toolbox_skills.py @@ -8,7 +8,7 @@ import httpx from agent_framework import Agent, MCPSkillsSource, SkillsProvider from agent_framework.foundry import FoundryChatClient from azure.core.credentials import TokenCredential -from azure.identity import DefaultAzureCredential, get_bearer_token_provider +from azure.identity import AzureCliCredential, get_bearer_token_provider from dotenv import load_dotenv from mcp.client.session import ClientSession from mcp.client.streamable_http import streamable_http_client @@ -47,11 +47,7 @@ class _BearerAuth(httpx.Auth): async def main() -> None: """Example showing toolbox-hosted MCP skills for a Foundry Chat Client agent.""" - # WARNING: DefaultAzureCredential is convenient for development but requires careful - # consideration in production. Consider using a specific credential (e.g., - # ManagedIdentityCredential) to avoid latency, unintended credential probing, and - # potential security risks from fallback mechanisms. - credential = DefaultAzureCredential() + credential = AzureCliCredential() # HTTP client that signs every request with a fresh Foundry bearer token # and advertises the toolbox preview feature flag, plus the MCP streamable