Skip to content

fix(portal): Fix agent AzureOpenAI resource IDs for conversational agents#9256

Open
lambrianmsft wants to merge 1 commit into
Azure:mainfrom
lambrianmsft:lambrian/conversation_agent_bug
Open

fix(portal): Fix agent AzureOpenAI resource IDs for conversational agents#9256
lambrianmsft wants to merge 1 commit into
Azure:mainfrom
lambrianmsft:lambrian/conversation_agent_bug

Conversation

@lambrianmsft
Copy link
Copy Markdown
Contributor

@lambrianmsft lambrianmsft commented Jun 5, 2026

Ensure AzureOpenAI agent connections persist account-level resource IDs while preserving MicrosoftFoundry model suffix handling. Normalize agent connection RBAC scopes before role lookup and assignment, and add focused unit coverage for serialization, scope normalization, and model type fallback behavior.

Commit Type

  • feature - New functionality
  • fix - Bug fix
  • refactor - Code restructuring without behavior change
  • perf - Performance improvement
  • docs - Documentation update
  • test - Test-related changes
  • chore - Maintenance/tooling

Risk Level

  • Low - Minor changes, limited scope
  • Medium - Moderate changes, some user impact
  • High - Major changes, significant user/system impact

What & Why

Validation errors occurred after Azure OpenAI resources were selected for the agent. Saving caused validation errors due to an incorrect UX contract. Updated the contract to align with the contract.

Impact of Change

  • Users:
    Users should be able to create agent connections from Azure OpenAI.
  • Developers:
  • System:

Test Plan

  • Unit tests added/updated
  • E2E tests added/updated
  • Manual testing completed
  • Tested in:

Contributors

Screenshots/Videos

Ensure AzureOpenAI agent connections persist account-level resource IDs while preserving MicrosoftFoundry model suffix handling. Normalize agent connection RBAC scopes before role lookup and assignment, and add focused unit coverage for serialization, scope normalization, and model type fallback behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 5, 2026 23:52
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

🤖 AI PR Validation Report

PR Review Results

Thank you for your submission! Here's detailed feedback on your PR title and body compliance:

PR Title

  • Current: fix(portal): Fix agent AzureOpenAI resource IDs for conversational agents
  • Issue: No blocking issue. The title is clear, specific, and matches the change.
  • Recommendation: None required.

Commit Type

  • Properly selected (fix).
  • Only one commit type is checked, which is correct.

⚠️ Risk Level

  • The selected risk level is Medium, which is reasonable for a change that affects agent connection serialization and role assignment behavior.
  • Advised risk level: Medium — this matches the submitter’s selection, so no escalation is needed.

What & Why

  • Current: Validation errors occurred after Azure OpenAI resources were selected for the agent. Saving caused validation errors due to an incorrect UX contract. Updated the contract to align with the contract.
  • Issue: The explanation is brief but sufficient.
  • Recommendation: Consider tightening the wording to avoid repetition, e.g. “Saving Azure OpenAI agent connections caused validation errors because the UX contract stored an incorrect resource ID shape. This change aligns serialization and role-assignment handling with the expected contract.”

Impact of Change

  • The impact section is present and identifies the user-facing effect.
  • Recommendation:
    • Users: Good as-is; consider adding that existing AzureOpenAI and MicrosoftFoundry agent connections are both affected by the resource ID normalization.
    • Developers: Mentioned implicitly; you could note the new operationParameterValues.agentModelType dependency for clearer maintenance context.
    • System: If desired, add that role-assignment lookup now normalizes /models suffixes before querying/assigning RBAC.

Test Plan

  • Unit tests were added/updated in the diff, which satisfies the test-plan requirement.
  • Manual testing is also checked, which is fine.
  • No blocking test-plan issue found.

Contributors

  • Blank is acceptable.
  • Recommendation: Optional only — add contributors if PMs/designers/others helped shape the contract change.

Screenshots/Videos

  • Blank is acceptable because this is not a visual/UI-only change.

Summary Table

Section Status Recommendation
Title None required
Commit Type None required
Risk Level Medium is appropriate
What & Why Optional wording polish only
Impact of Change Optional detail could be added
Test Plan Unit tests present in diff
Contributors Optional to add contributors
Screenshots/Videos Not required for this change

This PR passes review for title/body compliance. The advised risk level is not higher than the submitter’s selection.


Last updated: Sat, 06 Jun 2026 03:43:12 GMT

Copy link
Copy Markdown
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 fixes conversational agent connection serialization so AzureOpenAI connections persist the account-level Cognitive Services resource ID (instead of incorrectly saving /models), while preserving the /models suffix for MicrosoftFoundry model connections. It also normalizes the resource scope used for RBAC role detection/assignment and adds targeted unit coverage for the updated behaviors.

Changes:

  • Update agent connection serialization to only append /models for agentModelType=MicrosoftFoundry, and otherwise persist an account-level resource ID.
  • Normalize the RBAC role-assignment scope by stripping a terminal /models before querying/assigning roles and before invalidating role-assignment cache keys.
  • Add unit tests covering serialization outcomes, “no double-append” behavior, and model-type fallback logic based on resource ID shape.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
libs/logic-apps-shared/src/designer-client-services/lib/standard/index.ts Re-exports the new normalization helper from the standard connection module.
libs/logic-apps-shared/src/designer-client-services/lib/standard/connection.ts Adjusts agent connection resourceId persistence rules and introduces a normalization helper for role-assignment scope.
libs/logic-apps-shared/src/designer-client-services/lib/standard/tests/connection.spec.ts Adds unit tests for AzureOpenAI vs MicrosoftFoundry serialization and normalization behavior.
libs/logic-apps-shared/src/designer-client-services/lib/connection.ts Extends ConnectionCreationInfo to carry operationParameterValues needed for model-type-aware serialization.
libs/designer/src/lib/ui/panel/connectionsPanel/createConnection/createConnectionInternal.tsx Passes operationParameterValues into ConnectionCreationInfo during connection creation.
libs/designer/src/lib/core/actions/bjsworkflow/test/connectionsAgent.spec.ts Updates regression tests for model-type resolution using shared regexes and adds MicrosoftFoundry fallback coverage.
libs/designer-v2/src/lib/ui/panel/connectionsPanel/createConnection/createConnectionInternal.tsx Same as v1: passes operationParameterValues through to connection creation.
libs/designer-v2/src/lib/core/actions/bjsworkflow/test/connectionsAgentV2.spec.ts Same as v1: updates regression tests for model-type resolution + MicrosoftFoundry fallback coverage.
apps/Standalone/src/designer/app/AzureLogicAppsDesigner/laDesignerV2.tsx Normalizes RBAC role-assignment scope for agent connections before role lookup/assignment and cache invalidation.
apps/Standalone/src/designer/app/AzureLogicAppsDesigner/laDesigner.tsx Same as v2: normalizes RBAC role-assignment scope for agent connections.

Comment on lines 157 to +161
export const foundryServiceConnectionRegex = /\/Microsoft\.CognitiveServices\/accounts\/[^/]+\/projects\/[^/]+/;
export const apimanagementRegex = /\/Microsoft\.ApiManagement\/service\/[^/]+\/apis\/[^/]+/;
export const microsoftFoundryModelsRegex = /\/models$/;
export const normalizeAgentConnectionResourceIdForRoleAssignment = (resourceId?: string): string =>
resourceId?.replace(microsoftFoundryModelsRegex, '') ?? '';
@lambrianmsft lambrianmsft added the risk:medium Medium risk change with potential impact label Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-validated risk:medium Medium risk change with potential impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants