fix(s41): pass required credential in AzureFoundryBackend.create_chat_client
This commit is contained in:
parent
eb552f854e
commit
82c85d5e7c
4 changed files with 27 additions and 2 deletions
|
|
@ -103,8 +103,17 @@ class AzureFoundryBackend:
|
|||
endpoint = os.environ.get("PORTFOLIO_FOUNDRY_PROJECT_ENDPOINT")
|
||||
if not endpoint:
|
||||
raise ValueError("PORTFOLIO_FOUNDRY_PROJECT_ENDPOINT is required for the AZURE profile")
|
||||
# Credential resolves lazily via Azure DefaultAzureCredential (az login / MI).
|
||||
return FoundryChatClient(project_endpoint=endpoint, model=model)
|
||||
# FoundryChatClient REQUIRES an explicit credential (verified against agent-framework-foundry
|
||||
# 1.8.2 — it raises ``ValueError`` without one; there is NO lazy DefaultAzureCredential
|
||||
# default). Lazy import so the LOCAL path never pulls azure.identity. AzureCliCredential is
|
||||
# the documented, friction-minimal path on a non-Azure host — constructing it acquires NO
|
||||
# token (``az login`` is the operator's manual step), so this is not auto-login. Recipe:
|
||||
# docs/2026-07-15-foundry-auth-recipe.md.
|
||||
from azure.identity.aio import AzureCliCredential
|
||||
|
||||
return FoundryChatClient(
|
||||
project_endpoint=endpoint, model=model, credential=AzureCliCredential()
|
||||
)
|
||||
|
||||
|
||||
class LocalBackend:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue