Skip to content

Agents fail silently when using Managed Identity authentication #769

@vivche

Description

@vivche

Description

When the application is configured to use Azure Managed Identity (MI) for Azure OpenAI
authentication, agents that have only a deployment name set in their Model & Connection
configuration fail to load silently. Instead of reporting an error, the chat falls back to
plain GPT-4.1 with no tools or instructions attached, causing the model to fabricate responses
rather than call real APIs.


Steps to Reproduce

  1. Configure the application to use Managed Identity for Azure OpenAI (no API key stored in settings)
  2. Create or edit an agent and set only the deployment name in the Model & Connection step (leave endpoint and key blank)
  3. Start a chat with that agent
  4. Observe the agent responds as a generic assistant — tools are not called and instructions are not applied

Expected Behavior

The agent loads successfully using the Managed Identity credential and calls its configured actions/tools.

Actual Behavior

The agent silently fails to load. The SK Loader logs:

[SK Loader] Azure config INVALID for <agent_name>:
  - AzureChatCompletion available: True
  - endpoint: True
  - key: False
  - deployment: True

Chat falls back to plain GPT-4.1 with no tools or system instructions.


Root Cause

When an agent has only the deployment name set, resolve_agent_config() hits case 4 of its
decision tree and merges the agent's partial config with global settings. After the merge, key
is None (because MI auth stores no API key). The gate condition in semantic_kernel_loader.py
(~line 768) requires agent_config["key"] to be truthy:

if AzureChatCompletion and agent_config["endpoint"] and agent_config["key"] and agent_config["deployment"]:

With key = None, the condition is False and the agent is never constructed.


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Pending Evaluation

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions