Skip to content

Comments

bugfix - fixed content safety client creation w/ APIM & managed identity#633

Merged
paullizer merged 1 commit intomicrosoft:Developmentfrom
Xeelee33:bugfix/content_safety_config
Jan 23, 2026
Merged

bugfix - fixed content safety client creation w/ APIM & managed identity#633
paullizer merged 1 commit intomicrosoft:Developmentfrom
Xeelee33:bugfix/content_safety_config

Conversation

@Xeelee33
Copy link
Contributor

A logic bug in config.py prevents the content_safety_client from being created unless a content safety API key is present in the settings because the if condition required both the endpoint and the key before continuing to client creation:

if safety_endpoint and safety_key:

image

This bugfix simply removes the "and safety_key" from the condition so the clients can be created properly whether the authentication uses API key, managed identity, or APIM.

Tested using the prompt from Microsoft's docs here: https://microsoft.github.io/TechExcel-Operationalize-LLMs-with-LLMOps-automation/docs/01_intro_to_llms/01_03.html#:~:text=and%20select%20Run-,Test,-.

Behavior before change:
image

Behavior after change:
image

Copilot AI review requested due to automatic review settings January 23, 2026 05:02
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 pull request fixes a bug in the content safety client initialization logic that prevented the client from being created when using managed identity or APIM authentication. The original code incorrectly required both the endpoint AND the API key to be present, blocking scenarios where authentication is handled via managed identity or APIM subscription keys.

Changes:

  • Removed the and safety_key condition from the content safety client initialization check, allowing the client to be created with only the endpoint present
  • This enables proper client creation for all three authentication methods: API key, managed identity, and APIM

@paullizer paullizer self-requested a review January 23, 2026 16:47
Copy link
Contributor

@paullizer paullizer left a comment

Choose a reason for hiding this comment

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

nice fix!

@paullizer paullizer merged commit 5cd3e1d into microsoft:Development Jan 23, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants