Skip to content

feat: add entra agent identity list command - #7592

Open
mziada wants to merge 4 commits into
pnp:mainfrom
mziada:feat/entra-agent-identity-list
Open

mziada wants to merge 4 commits into
pnp:mainfrom
mziada:feat/entra-agent-identity-list

Conversation

@mziada

@mziada mziada commented Sep 27, 2026 •

Copy link
Copy Markdown

Summary

  • Add entra agent identity list using the Microsoft Graph agent identity list endpoint, with optional --properties and default text output of ID and display name.
  • Register AgentIdentity.Read.All, add command docs and sidebar navigation.
  • Add targeted command tests and response examples. Implements New command: entra agent identity list #7254.

Verification

  • Targeted command tests: 10 passing.
  • Targeted ESLint: pass.
  • Command-file coverage: 100% statements, branches, functions, and lines.
  • Full build and test suite: awaiting CI.
  • No live Microsoft 365 tenant test; documented responses are illustrative.

@mziada
mziada force-pushed the feat/entra-agent-identity-list branch from ffff637 to cb2d4b4 Compare September 27, 2026 22:03
@mziada
mziada marked this pull request as ready for review September 27, 2026 22:04
@milanholemans

Copy link
Copy Markdown
Contributor

Hi @mziada we require everyone to first get assigned to an issue before working on it. This keeps our backlog clean and up-to-date. This also prevents multiple people working on the same issue.

So please follow our guidelines if you want to contribute to the project. 🙏

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Add verbose logging, update documentation details, and regenerate the command index.

Review effort: Lite
Findings: 1 Medium severity · 2 Low severity

Open (3)
What changed in this PR

Adds entra agent identity list with Microsoft Graph integration, property selection, permissions, tests, and documentation.

Changes:

  • Implemented the command and targeted tests.
  • Registered AgentIdentity.Read.All.
  • Added documentation, response examples, and sidebar navigation.
File Description
src/​m365/​entra/​commands/​agent/​agent-identity-list.ts Command implementation
src/​m365/​entra/​commands/​agent/​agent-identity-list.spec.ts Command tests
src/​m365/​entra/​commands.ts Command registration
src/​config.ts Permission scope
docs/​src/​config/​sidebars.ts Sidebar navigation
docs/​docs/​cmd/​entra/​agent/​agent-identity-list.mdx Command documentation

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.


The command returns only agent identity objects. Other types of service principals aren't returned.

A principal who creates an agent identity blueprint or blueprint principal is automatically assigned as the owner. Owners can create and modify agent identities associated with a blueprint they own without being assigned an Agent ID role. For nonowners to call this API in delegated scenarios using work or school accounts, the admin must be assigned a supported Microsoft Entra role. This operation supports the least-privileged built-in role **Agent ID Administrator**. For more information, see the [Microsoft Graph API documentation](https://learn.microsoft.com/en-us/graph/api/agentidentity-list).
ADMINISTRATIVEUNIT_MEMBER_LIST: `${prefix} administrativeunit member list`,
ADMINISTRATIVEUNIT_MEMBER_REMOVE: `${prefix} administrativeunit member remove`,
ADMINISTRATIVEUNIT_ROLEASSIGNMENT_ADD: `${prefix} administrativeunit roleassignment add`,
AGENT_IDENTITY_LIST: `${prefix} agent identity list`,
@mziada

mziada commented Oct 3, 2026

Copy link
Copy Markdown
Author

Thanks for the heads-up. I missed the issue-assignment step before opening the PR.

Before we go further, I also want to be upfront about how this contribution was put together: AI agents produced the implementation and tests; I chose the issue and approved the PR submission. Would you be comfortable accepting a contribution made that way?

If so, could you assign issue #7254 to me so I can continue with PR #7592 and address the review feedback? If that approach doesn't fit the project's contribution rules, I understand and won't take it further.

@milanholemans

Copy link
Copy Markdown
Contributor

AI is fine, everyone uses it. Just comment on the issue and we'll assign it to you.

@mziada

mziada commented Oct 4, 2026

Copy link
Copy Markdown
Author

While addressing the review feedback, I found a permissions discrepancy worth checking before changing the remarks. Issue #7254 and the automated review include Agent ID Developer, but the current Graph v1.0 and beta references list only Agent ID Administrator for nonowner delegated calls to list agent identities. The Entra role reference describes Developer as permitting blueprint creation and making the creator an owner.

Would you prefer that I retain Administrator for nonowner listing and document Developer separately as a blueprint-creation/ownership role, or is there another authoritative reference confirming Developer also supports nonowner listing?

@mziada

mziada commented Oct 21, 2026

Copy link
Copy Markdown
Author

Hi @milanholemans, just gently following up on the permissions question above when you have a moment. Would you prefer that I retain Agent ID Administrator for nonowner delegated listing and describe Agent ID Developer separately for blueprint creation/ownership? I’d appreciate your steering before updating the remarks. Thanks!

@milanholemans

Copy link
Copy Markdown
Contributor

I would just check whether the API supports it or not. If it doesn't, then drop it.

- Log the retrieval step to stderr before Graph calls in verbose mode
- Cover logging order, quiet output, state reuse and paginated results
- Add the command to the canonical discovery index
@mziada

mziada commented Oct 24, 2026

Copy link
Copy Markdown
Author

Thanks, @milanholemans. I've kept the existing Agent ID Administrator wording for nonowner delegated listing, following the Graph v1.0 list-operation reference, which does not list Agent ID Developer for this operation. I haven't verified Developer-role access in a live tenant, so I'm not claiming that a live test proved it unsupported.

I've also addressed the verbose logging and command-index feedback and added five tests. The local build, scoped lint, command help and 15 focused tests pass, with 100% command coverage (refreshed October 23). The full suite (16,178 tests) and production docs build passed on the same reviewed source on October 4. Upstream CI remains to be verified for the pushed revision.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

An active documentation issue remains because the remark omits the supported Agent ID Developer role and the required Microsoft Entra role-permissions reference.

2 open issues
1 previously missed issue

In code that hasn't changed since last review

Low severity Document Agent ID Developer role and permissions reference

docs/​docs/​cmd/​entra/​agent/​agent-identity-list.mdx:30

The issue asks this remark to document both supported delegated roles and the Microsoft Entra role-permissions reference. This only names Agent ID Administrator and links to the Graph API page, so it omits the supported Agent ID Developer role and its documented scope.

1 resolved since last review

Review effort: Lite

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Approval is blocked by an incomplete authorization note for the Agent ID Developer role and a critical test assertion that does not match the query-encoding behavior.

3 open issues

Review effort: Lite

await command.action(logger, { options: commandOptionsSchema.parse({ properties: 'id&$filter=displayName eq \'My Agent Identity\'' }) });

const parsedUrl = new URL(requestedUrl);
assert.strictEqual(parsedUrl.searchParams.get('$select'), 'id&$filter=displayName eq My Agent Identity');
@mziada

mziada commented Nov 6, 2026

Copy link
Copy Markdown
Author

Thanks for the review. A couple of clarifications on the current revision:

  • Apostrophe assertion: the command removes single and double quotes from --properties before passing the value to formatting.encodeQueryParameter. The quote-free expected value therefore matches the implementation. I checked this with a focused reproduction: the assertion passes, and $filter remains part of the $select value rather than becoming a separate query parameter.
  • Command index: skills/clim365/references/commands.txt already includes:
    entra agent identity list|Retrieves a list of agent identities
    
  • Permissions documentation: following the earlier discussion with @milanholemans, the remarks retain Agent ID Administrator for nonowner delegated listing, based on the Graph list-operation reference. I haven’t verified Agent ID Developer access in a live tenant and am not claiming a live test proved it unsupported. If there’s an authoritative reference confirming that role supports this operation, I’m happy to revisit the wording.

The current CI checks are also passing.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The remarks document only Agent ID Administrator and omit the supported Agent ID Developer role and its scope, leaving delegated-access guidance incomplete.

4 open issues

Review effort: Lite


The command returns only agent identity objects. Other types of service principals aren't returned.

A principal who creates an agent identity blueprint or blueprint principal is automatically assigned as the owner. Owners can create and modify agent identities associated with a blueprint they own without being assigned an Agent ID role. For nonowners to call this API in delegated scenarios using work or school accounts, the admin must be assigned a supported Microsoft Entra role. This operation supports the least-privileged built-in role **Agent ID Administrator**. For more information, see the [Microsoft Graph API documentation](https://learn.microsoft.com/en-us/graph/api/agentidentity-list).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Approval is blocked by a moderate text-formatting bug that drops valid custom --properties values, along with documentation gaps about supported roles and output-mode behavior.

6 open issues

Review effort: Lite

Comment on lines +48 to +50
public defaultProperties(): string[] | undefined {
return ['id', 'displayName'];
}

## Remarks

Using the `--properties` option, you can specify a comma-separated list of agent identity properties to retrieve from the Microsoft Graph. If you don't specify any properties, the command will output the default properties returned by Graph.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The documentation omits the required Agent ID Developer role and its limited blueprint/blueprint-principal scope, leaving delegated users with incomplete guidance.

6 open issues

Review effort: Lite

This branch has not been deployed

No deployments
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.

3 participants