Skip to content

Designer: Save silently fails for MSI agent connections when a checked built-in role (e.g. 'Azure AI User') does not exist in the tenant #9282

Description

@Elaina-Lee

Severity

P2 - High (Major functionality broken)

Describe the Bug with repro steps

For a workflow with a Managed Service Identity agent connection (e.g. Azure OpenAI), saving crashes with:

TypeError: Cannot read properties of undefined (reading 'id')
    at role.ts:126
    at getMissingRoleDefinitions

In designer v1 the Save button becomes a silent no-op (error only in console, no network traffic on subsequent clicks because the underlying queries are cached); in designer-v2 the same error breaks autosave, Run draft, and Publish.

Repro:

  1. Use a tenant where ARM's built-in role definitions list ($filter=type eq 'BuiltInRole') does not include Azure AI User (confirmed via HAR: 929 roles returned, Azure AI User absent while Azure AI Administrator / Azure AI Developer / Cognitive Services Contributor exist).
  2. Create an MSI agent connection to an Azure OpenAI resource and save → first save on a fresh app succeeds (zero role assignments hits the early-return path) and assigns the available roles.
  3. Save again (or create a second MSI connection and save) → crash. Deleting the connection does not help because the role assignments persist on the resource.

Root cause

getMissingRoleDefinitions (duplicated in libs/designer and libs/designer-v2) iterates all requested role names and dereferences definitions[name].id, but the definitions record only contains names actually found in ARM's built-in role list. When the app identity already has assignments at the resource scope, the unguarded loop runs and crashes on the missing name.

Fix

PR #9279 — skip role names with no matching definition (a role that does not exist in the environment cannot be assigned) and guard the roleDefinitionId access.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions