Skip to content

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

Open
waleedlatif1 wants to merge 3 commits into
stagingfrom
feat/entra-id-depth
Open

feat(microsoft_ad): licensing, security, audit, role, and device operations#6742
waleedlatif1 wants to merge 3 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 abc14c2 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 15, 2026 11:18pm

Request Review

@cursor

cursor Bot commented Aug 15, 2026

Copy link
Copy Markdown

PR Summary

High Risk
Adds privileged Entra ID writes (passwords, licenses, admin roles, app access, session revocation) and broad new OAuth scopes, so mistakes or over-scoped workflows have tenant-wide security impact; re-consent affects all existing microsoft-ad connections.

Overview
Expands the Azure AD / Microsoft Entra ID integration from 13 to 36 workflow operations, with matching updates to the block UI, integration catalog, and docs.

New capabilities include license assign/list and tenant SKUs; password set/reset, auth-method listing, and sign-in session revocation; sign-in and directory audit log reads; app role grant/revoke and service-principal/application assignment listing; directory role member add/remove; device list/get and per-user device reads; and read-only conditional access policy list/get. Descriptions now stress identities, licenses, roles, and access; device writes are explicitly not supported.

The block adds operation-specific sub-blocks (license SKUs, password/MFA flags, per-endpoint OData filters with wand helpers for sign-ins and audits, role/device/policy IDs) and canvas sentences for each new operation. Paging is centralized via shared PAGED_OPERATIONS / NEXT_LINK_OPERATIONS. Filter/search are mapped per operation (FILTER_FIELD_BY_OPERATION / SEARCH_FIELD_BY_OPERATION) so switching operations clears stale $filter/$search values instead of sending invalid Graph queries.

OAuth for microsoft-ad adds eight delegated scopes (licenses, auth methods/passwords, audit logs, applications, app roles, directory roles, devices, policies), with labels in oauth/utils.ts. Existing connections will need re-consent to use the new tools.

Docs refresh create-user output fields (e.g. businessPhones, preferredLanguage vs removed department/accountEnabled in that table) and document every new action’s inputs/outputs.

Reviewed by Cursor Bugbot for commit 08b8ff1. 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, role assignments, service-principal discovery, device reads, and conditional-access reads.

  • Adds and registers 24 Microsoft AD operations with their request and response mappings.
  • Extends the block UI, OAuth scopes, generated metadata, output types, integration catalog, and public documentation.
  • Retains read-only device support and maps operation-specific filtering, searching, and pagination fields.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains from the prior review threads.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/blocks/blocks/microsoft_ad.ts Expands the block operation catalog and maps operation-specific inputs, filters, searches, pagination, and password options.
apps/sim/lib/oauth/oauth.ts Adds delegated Microsoft Graph scopes required by the newly exposed operations.
apps/sim/tools/microsoft_ad/reset_password.ts Implements asynchronous password reset and correctly reads a generated password from the response root.
apps/sim/tools/microsoft_ad/revoke_sign_in_sessions.ts Implements delegated session revocation using an already-requested qualifying permission.
apps/sim/tools/registry.ts Registers the new Microsoft AD tools for runtime dispatch.
apps/docs/content/docs/en/integrations/microsoft_ad.mdx Documents the expanded operation set, inputs, outputs, privilege implications, and read-only device support.

Sequence Diagram

sequenceDiagram
  participant Workflow
  participant Block as Microsoft AD Block
  participant Tool as Selected Microsoft AD Tool
  participant Graph as Microsoft Graph v1.0
  Workflow->>Block: Execute configured operation
  Block->>Block: Map operation-specific parameters
  Block->>Tool: Dispatch registered tool
  Tool->>Graph: Send OAuth-authenticated request
  Graph-->>Tool: Return operation response
  Tool-->>Workflow: Return normalized workflow output
Loading

Reviews (4): Last reviewed commit: "fix(microsoft_ad): clear non-owning filt..." | Re-trigger Greptile

Comment thread apps/sim/tools/microsoft_ad/reset_password.ts
Comment thread apps/sim/lib/oauth/oauth.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.
@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
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.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

…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.
@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.

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