Skip to content

[Agents Extension] Updates to pull rbac identity from the agent version#7747

Open
trangevi wants to merge 4 commits intomainfrom
trangevi/rbac-change
Open

[Agents Extension] Updates to pull rbac identity from the agent version#7747
trangevi wants to merge 4 commits intomainfrom
trangevi/rbac-change

Conversation

@trangevi
Copy link
Copy Markdown
Member

The agent identity is now available on the agent version object, updating handling to use that instead of relying on graph

Signed-off-by: trangevi <trangevi@microsoft.com>
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

Note

Copilot was unable to run its full agentic suite in this review.

Updates the agents extension to source per-agent RBAC principal IDs from the agent version object (when available) to avoid Graph-based identity discovery.

Changes:

  • Extends agent version API models to include instance identity, blueprint identity/reference, status, and agent GUID.
  • Updates post-deploy RBAC setup to fetch agent versions and pass principal IDs through to RBAC assignment (falling back to Graph when missing).
  • Enhances show output/tests to surface the newly added agent version fields and switches vnext show to the vnext API version constant.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
cli/azd/extensions/azure.ai.agents/internal/project/agent_identity_rbac.go Accepts name→principalID map and skips Graph discovery when principal IDs are known.
cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_api/models.go Adds fields/types to represent identity/blueprint info on agent version objects.
cli/azd/extensions/azure.ai.agents/internal/pkg/agents/agent_api/models_test.go Expands round-trip coverage for newly added agent version fields.
cli/azd/extensions/azure.ai.agents/internal/cmd/show.go Uses vnext API version for vnext show and prints new fields in table format.
cli/azd/extensions/azure.ai.agents/internal/cmd/show_test.go Validates JSON/table output includes the newly added fields.
cli/azd/extensions/azure.ai.agents/internal/cmd/listen.go Postdeploy now fetches agent versions to obtain principal IDs for RBAC assignment.

Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/listen.go Outdated
Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/listen.go
Copy link
Copy Markdown
Member

@jongio jongio left a comment

Choose a reason for hiding this comment

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

Nice optimization - skipping Graph API polling is a solid improvement. A few things to sort out before this is ready:

The main concern is that the new credential + API calls in postdeployHandler run unconditionally, before the vnext gate in EnsureAgentIdentityRBAC. This means non-vnext projects pay for unnecessary HTTP calls and can fail on missing env vars. Additionally, GetAgentVersion uses the older API version while show.go was updated to the vnext version in this same PR - if InstanceIdentity requires the newer version, the optimization won't actually kick in.

Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/listen.go
Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/listen.go Outdated
Comment thread cli/azd/extensions/azure.ai.agents/internal/cmd/listen.go Outdated
JeffreyCA added a commit to JeffreyCA/azure-dev that referenced this pull request Apr 15, 2026
Move the Conditional Access token protection (AADSTS530084) error detection
from the preflight developer RBAC check into the postdeploy agent identity
RBAC path, specifically in the Graph API fallback used when the agent version
API does not return a principal ID.

This aligns with the PR Azure#7747 changes that pull identity info from the agent
API directly — the token protection check is now only needed in the edge case
fallback path.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…P logging

- Gate postdeployHandler on isVNextEnabled early to avoid unnecessary API
  calls and credential creation for non-vnext projects
- Use DefaultVNextAgentAPIVersion for GetAgentVersion in postdeploy so
  instance_identity is actually returned by the API
- Restore continue for missing/empty AGENT_{KEY}_NAME/VERSION env vars
  instead of hard errors; separate RPC failures from empty values
- Remove redundant isVnextEnabled check from EnsureAgentIdentityRBAC
  (now checked by caller)
- Log when Graph API discovery finds multiple service principals for
  a single agent display name

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 15, 2026

📋 Prioritization Note

Thanks for the contribution! The linked issue isn't in the current milestone yet.
Review may take a bit longer — reach out to @rajeshkamal5050 or @kristenwomack if you'd like to discuss prioritization.

Signed-off-by: trangevi <trangevi@microsoft.com>
JeffreyCA added a commit to JeffreyCA/azure-dev that referenced this pull request Apr 15, 2026
Move the Conditional Access token protection (AADSTS530084) error detection
from the preflight developer RBAC check into the postdeploy agent identity
RBAC path, specifically in the Graph API fallback used when the agent version
API does not return a principal ID.

This aligns with the PR Azure#7747 changes that pull identity info from the agent
API directly — the token protection check is now only needed in the edge case
fallback path.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…7713)

Move the Conditional Access token protection (AADSTS530084) error detection
from the preflight developer RBAC check into the postdeploy agent identity
RBAC path, specifically in the Graph API fallback used when the agent version
API does not return a principal ID.

This aligns with the PR #7747 changes that pull identity info from the agent
API directly — the token protection check is now only needed in the edge case
fallback path.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Member

@jongio jongio left a comment

Choose a reason for hiding this comment

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

All my previous concerns are addressed - the vnext gate, API version fix, soft env var handling, and multi-SP logging all look good.

The flow is clean: fetch agent version with the vnext API version to get InstanceIdentity.PrincipalID, pass it through to RBAC assignment, skip Graph entirely when the principal ID is known. The lazy Graph client init for the fallback path and the token protection error detection are solid additions.

One minor note: this bumps azidentity to v1.14.0-beta.3 - just flagging in case that wasn't intentional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants