Skip to content

feat(microsoft_ad): licensing, security, audit, role, and device operations - #6742

Merged
waleedlatif1 merged 6 commits into
stagingfrom
feat/entra-id-depth
Aug 16, 2026
Merged

feat(microsoft_ad): licensing, security, audit, role, and device operations#6742
waleedlatif1 merged 6 commits into
stagingfrom
feat/entra-id-depth

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Deepens the Microsoft Entra ID (Azure AD) block from 12 to 36 tools, adding licensing, password/session management, sign-in and directory audit logs, app and directory role assignments, service principals, device reads, and conditional access policy reads.

Two things need a maintainer decision before merge:

1. Device write was dropped, deliberately

device-update and device-delete document Directory.AccessAsUser.All as the only delegated scope — the higher-privileged read is literally documented as "Not available", and Device.ReadWrite.All is application-only, so it is not reachable from a delegated connection. The operation additionally requires the signed-in user to hold Intune Administrator.

Rather than take act-as-the-signed-in-user directory access across the whole tenant for two operations that would still fail for most admins, both tools were removed. That took the count from 38 to 36, and Directory.AccessAsUser.All is not requested anywhere. Device support is read-only (Device.Read.All).

This is a one-commit revert if the team would rather ship them.

2. The new scopes force re-consent on every existing connection

Every existing microsoft-ad connection will need to re-consent to pick up the added scopes. That is a migration and comms question, not an engineering one — flagging it rather than deciding it.

Scopes added: LicenseAssignment.ReadWrite.All, UserAuthenticationMethod.ReadWrite.All, AuditLog.Read.All, Application.Read.All, AppRoleAssignment.ReadWrite.All, RoleManagement.ReadWrite.Directory, Device.Read.All, Policy.Read.All.

Also worth noting

  • All endpoints are Graph v1.0. No beta endpoints.
  • create_user no longer sends an undocumented ?$select=, which was silently nulling department and accountEnabled in the response.
  • Nothing was live-tested against a tenant. Everything is validated against the Graph v1.0 reference only.

GitGuardian finding — needs a dashboard dismissal

The scan flags 28c10230-6103-485e-b985-444c60001490 in reset_password.ts. That is Microsoft's fixed, publicly documented object id for a user's password authentication method — identical for every user in every tenant, and required as a literal route segment to build the resetPassword URL. It is a path component, not a credential. It's inlined at its single call site with a doc reference so the context is visible where it's read; someone with dashboard access will need to mark it as a false positive.

Type of Change

  • New feature (non-breaking change which adds functionality)

Testing

Validated against the Microsoft Graph v1.0 REST reference — endpoints, methods, required/optional params, response shapes, and the delegated permission listed per operation. Repo audits pass: tool-metadata:check, integration-catalog:check, check:canvas-sentences, check:api-validation:strict, lint, and typecheck. Not exercised against a live tenant.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@gitguardian

gitguardian Bot commented Aug 15, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
36185505 Triggered Generic Password 4377fb0 apps/sim/tools/microsoft_ad/reset_password.ts View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@vercel

vercel Bot commented Aug 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 16, 2026 2:35am

Request Review

@cursor

cursor Bot commented Aug 15, 2026

Copy link
Copy Markdown

PR Summary

High Risk
Adds privileged directory operations (passwords, licenses, admin roles, session revocation) and new OAuth scopes that force re-consent for all existing connections; not live-tested against a tenant.

Overview
Expands the Azure AD / Microsoft Entra ID block from 13 to 36 operations, backed by new Graph v1.0 tools and updated docs, integration catalog, and OAuth scopes.

New capabilities include license assign/list and tenant SKUs; revoke sign-in sessions; set/reset passwords and list auth methods; sign-in and directory audit logs; app role grant/revoke and service principal/application assignment reads; directory role member management; device and user-device reads; and conditional access policy reads (no device writes).

Block UX adds operation-specific sub-blocks (filters, paging, license SKUs, role IDs, etc.), canvas sentences for each operation, and stricter param mapping: OData filter/search are resolved per operation so switching operations does not leak stale $filter values; User ID / Service Principal ID can be optional when paging via nextLink.

OAuth adds eight delegated scopes (LicenseAssignment, auth methods, audit logs, applications, app roles, directory roles, devices, policies). Existing microsoft-ad connections must re-consent.

Docs refresh the create-user output fields and broaden the integration description to match the new surface.

Reviewed by Cursor Bugbot for commit 8957e72. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR expands the Microsoft Entra ID integration with licensing, password and session management, audit-log access, application and directory-role operations, service-principal queries, device reads, and conditional-access policy reads.

  • Adds and registers 24 Microsoft Graph tools, bringing the integration to 36 operations.
  • Extends OAuth consent scopes and block configuration for the new capabilities.
  • Updates generated tool catalogs, response types, integration metadata, and public documentation.
  • Deliberately keeps device support read-only and documents generated-password output handling.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/blocks/blocks/microsoft_ad.ts Expands operation selection, conditional inputs, pagination fields, and operation-specific parameter normalization for the new tools.
apps/sim/lib/oauth/oauth.ts Adds the delegated Microsoft Graph scopes required by the expanded integration.
apps/sim/tools/microsoft_ad/reset_password.ts Implements password reset using Graph’s password authentication method endpoint and correctly parses the root-level generated password.
apps/sim/tools/microsoft_ad/revoke_sign_in_sessions.ts Adds session revocation through an endpoint authorized by the provider’s requested User.ReadWrite.All scope.
apps/sim/tools/microsoft_ad/index.ts Registers and exports the expanded Microsoft AD tool set.
apps/docs/content/docs/en/integrations/microsoft_ad.mdx Documents the expanded operation catalog, read-only device support, and generated-password output behavior.

Sequence Diagram

sequenceDiagram
  participant Workflow
  participant Block as Microsoft AD Block
  participant Tool as Selected Graph Tool
  participant Graph as Microsoft Graph v1.0
  Workflow->>Block: Operation and parameters
  Block->>Tool: Map operation-specific inputs
  Tool->>Graph: OAuth-authenticated request
  Graph-->>Tool: Resource or operation response
  Tool-->>Block: Normalized tool output
  Block-->>Workflow: Workflow result
Loading

Reviews (9): Last reviewed commit: "fix(microsoft_ad): reject a continuation..." | Re-trigger Greptile

Comment thread apps/sim/tools/microsoft_ad/reset_password.ts
Comment thread apps/sim/lib/oauth/oauth.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/blocks/blocks/microsoft_ad.ts Outdated
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 08b8ff1. Configure here.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/blocks/blocks/microsoft_ad.ts
Comment thread apps/sim/blocks/blocks/microsoft_ad.ts
Comment thread apps/sim/tools/microsoft_ad/reset_password.ts
Comment thread apps/sim/blocks/blocks/microsoft_ad.ts
Comment thread apps/sim/blocks/blocks/microsoft_ad.ts
Comment thread apps/sim/blocks/blocks/microsoft_ad.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/blocks/blocks/microsoft_ad.ts
…ations

Deepens the Microsoft Entra ID block from 12 to 36 tools against the Microsoft
Graph v1.0 reference: license assignment and tenant SKUs, password set/reset,
sign-in session revocation, authentication methods, sign-in and directory audit
logs, app role and directory role assignments, service principals, device reads,
and conditional access policy reads.

Device write (device-update, device-delete) is deliberately excluded. Both
document Directory.AccessAsUser.All as their only delegated scope, with the
higher-privileged read documented as unavailable, so supporting them would mean
requesting tenant-wide act-as-the-user directory access for two operations that
additionally require the caller to hold Intune Administrator.

Also drops an undocumented ?$select= from create_user that was silently nulling
department and accountEnabled in the response.
The params mapper assigned result.filter from each filter subBlock in turn, so
the last non-empty one won regardless of the selected operation. Because a
subBlock keeps its value after the operation changes, a filter written for one
endpoint was sent to every other collection operation — invalid OData against a
different Graph resource, or a silently wrong page.

Resolves the filter and search terms from an explicit operation-to-field map
instead, so each operation reads only the field it owns.
…nputs

The executor merges { ...inputs, ...transformedParams }, so declining to copy a
stale filter is not enough — the serialized value survives the merge and still
reaches the tool. Advanced-mode subBlocks are serialized on non-emptiness alone
and never have their condition evaluated, so the value is present even when the
field is hidden.

Write filter and search on every operation, as undefined when the operation owns
neither, so the merge clears them.
…ontinue without a User ID

The set_password MFA dropdown only wrote its key when non-empty, so the "No Change"
empty string survived `{ ...inputs, ...transformedParams }` and reached Graph in place
of a boolean. Assign it explicitly, including as `undefined`, the same way `filter` and
`search` are handled.

`list_user_app_role_assignments` and `list_user_devices` page by `@odata.nextLink`, and
both tools already treat `userId` as optional once a continuation URL is supplied. Drop
them from the required set when Next Page is filled in so pagination-only runs pass block
validation.

Also note on the reset_password output that a generated password reaches workflow outputs,
run history, and the model, matching how other tools that return secrets document exposure.
… page

Every other single-resource ID field pairs its condition with a matching required
rule; servicePrincipalId had none, so a first-page run could pass block validation
with an empty ID and fail inside the tool instead. Require it unless a continuation
URL is supplied, matching the paged per-user operations.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/blocks/blocks/microsoft_ad.ts
Every paged operation reads the one shared Next Page field, and a subBlock keeps
its value after the operation changes. Paging /users and then switching the block
to /devices short-circuited back to the user page, silently returning the previous
collection instead of the selected one.

Assert the continuation URL's terminal path segment against the collection the tool
actually reads, which also rejects a nextLink pasted from an unrelated response.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 8957e72. Configure here.

@waleedlatif1
waleedlatif1 merged commit 257029a into staging Aug 16, 2026
30 checks passed
@waleedlatif1
waleedlatif1 deleted the feat/entra-id-depth branch August 16, 2026 02:39
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.

1 participant