-
Notifications
You must be signed in to change notification settings - Fork 3.8k
feat(microsoft_ad): licensing, security, audit, role, and device operations #6742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4377fb0
feat(microsoft_ad): licensing, security, audit, role, and device oper…
waleedlatif1 0110221
fix(microsoft_ad): resolve OData filter and search by owning operation
waleedlatif1 5c2371c
fix(microsoft_ad): clear non-owning filter and search on the merged i…
waleedlatif1 5a3568a
fix(microsoft_ad): clear the MFA flag and let paged user operations c…
waleedlatif1 f83165b
fix(microsoft_ad): require the service principal ID only on the first…
waleedlatif1 8957e72
fix(microsoft_ad): reject a continuation URL from a different collection
waleedlatif1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
473 changes: 469 additions & 4 deletions
473
apps/docs/content/docs/en/integrations/microsoft_ad.mdx
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| import type { | ||
| MicrosoftAdAddDirectoryRoleMemberParams, | ||
| MicrosoftAdAddDirectoryRoleMemberResponse, | ||
| } from '@/tools/microsoft_ad/types' | ||
| import type { ToolConfig } from '@/tools/types' | ||
|
|
||
| export const addDirectoryRoleMemberTool: ToolConfig< | ||
| MicrosoftAdAddDirectoryRoleMemberParams, | ||
| MicrosoftAdAddDirectoryRoleMemberResponse | ||
| > = { | ||
| id: 'microsoft_ad_add_directory_role_member', | ||
| name: 'Add Microsoft Entra ID Directory Role Member', | ||
| description: | ||
| 'Grant a user an administrator role in Microsoft Entra ID. This is a privileged change that expands what the user can do across the tenant.', | ||
| version: '1.0.0', | ||
| errorExtractor: 'nested-error-object', | ||
| oauth: { | ||
| required: true, | ||
| provider: 'microsoft-ad', | ||
| }, | ||
| params: { | ||
| accessToken: { | ||
| type: 'string', | ||
| required: true, | ||
| visibility: 'hidden', | ||
| description: 'Microsoft Graph API access token', | ||
| }, | ||
| directoryRoleId: { | ||
| type: 'string', | ||
| required: true, | ||
| visibility: 'user-or-llm', | ||
| description: 'Object ID of the directory role. Use List Directory Roles to find it.', | ||
| }, | ||
| memberId: { | ||
| type: 'string', | ||
| required: true, | ||
| visibility: 'user-or-llm', | ||
| description: 'Object ID of the user to grant the role to', | ||
| }, | ||
| }, | ||
| request: { | ||
| url: (params) => { | ||
| const directoryRoleId = params.directoryRoleId?.trim() | ||
| if (!directoryRoleId) throw new Error('Directory role ID is required') | ||
| return `https://graph.microsoft.com/v1.0/directoryRoles/${encodeURIComponent(directoryRoleId)}/members/$ref` | ||
| }, | ||
| method: 'POST', | ||
| headers: (params) => ({ | ||
| Authorization: `Bearer ${params.accessToken}`, | ||
| 'Content-Type': 'application/json', | ||
| }), | ||
| body: (params) => { | ||
| const memberId = params.memberId?.trim() | ||
| if (!memberId) throw new Error('Member ID is required') | ||
| return { | ||
| '@odata.id': `https://graph.microsoft.com/v1.0/directoryObjects/${memberId}`, | ||
| } | ||
| }, | ||
| }, | ||
| transformResponse: async ( | ||
| _response: Response, | ||
| params?: MicrosoftAdAddDirectoryRoleMemberParams | ||
| ) => { | ||
| return { | ||
| success: true, | ||
| output: { | ||
| added: true, | ||
| directoryRoleId: params?.directoryRoleId ?? '', | ||
| memberId: params?.memberId ?? '', | ||
| }, | ||
| } | ||
| }, | ||
| outputs: { | ||
| added: { type: 'boolean', description: 'Whether the member was added successfully' }, | ||
| directoryRoleId: { type: 'string', description: 'ID of the directory role' }, | ||
| memberId: { type: 'string', description: 'ID of the member that was added' }, | ||
| }, | ||
| } |
95 changes: 95 additions & 0 deletions
95
apps/sim/tools/microsoft_ad/add_user_app_role_assignment.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| import type { | ||
| MicrosoftAdAddUserAppRoleAssignmentParams, | ||
| MicrosoftAdAddUserAppRoleAssignmentResponse, | ||
| } from '@/tools/microsoft_ad/types' | ||
| import { APP_ROLE_ASSIGNMENT_OUTPUT_PROPERTIES } from '@/tools/microsoft_ad/types' | ||
| import type { ToolConfig } from '@/tools/types' | ||
|
|
||
| export const addUserAppRoleAssignmentTool: ToolConfig< | ||
| MicrosoftAdAddUserAppRoleAssignmentParams, | ||
| MicrosoftAdAddUserAppRoleAssignmentResponse | ||
| > = { | ||
| id: 'microsoft_ad_add_user_app_role_assignment', | ||
| name: 'Grant Microsoft Entra ID App Role To User', | ||
| description: | ||
| 'Grant a user an application role on a service principal, giving them access to that application', | ||
| version: '1.0.0', | ||
| errorExtractor: 'nested-error-object', | ||
| oauth: { | ||
| required: true, | ||
| provider: 'microsoft-ad', | ||
| }, | ||
| params: { | ||
| accessToken: { | ||
| type: 'string', | ||
| required: true, | ||
| visibility: 'hidden', | ||
| description: 'Microsoft Graph API access token', | ||
| }, | ||
| userId: { | ||
| type: 'string', | ||
| required: true, | ||
| visibility: 'user-or-llm', | ||
| description: 'User ID or user principal name to grant the app role to', | ||
| }, | ||
| resourceId: { | ||
| type: 'string', | ||
| required: true, | ||
| visibility: 'user-or-llm', | ||
| description: | ||
| 'Object ID of the resource service principal that defines the app role. Use List Service Principals to find it.', | ||
| }, | ||
| appRoleId: { | ||
| type: 'string', | ||
| required: true, | ||
| visibility: 'user-or-llm', | ||
| description: | ||
| 'ID of the app role to grant. Use the all-zero GUID 00000000-0000-0000-0000-000000000000 to assign access without a specific role.', | ||
| }, | ||
| }, | ||
| request: { | ||
| url: (params) => { | ||
| const userId = params.userId?.trim() | ||
| if (!userId) throw new Error('User ID is required') | ||
| return `https://graph.microsoft.com/v1.0/users/${encodeURIComponent(userId)}/appRoleAssignments` | ||
| }, | ||
| method: 'POST', | ||
| headers: (params) => ({ | ||
| Authorization: `Bearer ${params.accessToken}`, | ||
| 'Content-Type': 'application/json', | ||
| }), | ||
| body: (params) => { | ||
| const resourceId = params.resourceId?.trim() | ||
| const appRoleId = params.appRoleId?.trim() | ||
| const principalId = params.userId?.trim() | ||
| if (!resourceId) throw new Error('Resource ID is required') | ||
| if (!appRoleId) throw new Error('App role ID is required') | ||
| return { principalId, resourceId, appRoleId } | ||
| }, | ||
| }, | ||
| transformResponse: async (response: Response) => { | ||
| const assignment = await response.json() | ||
| return { | ||
| success: true, | ||
| output: { | ||
| assignment: { | ||
| id: assignment.id ?? null, | ||
| appRoleId: assignment.appRoleId ?? null, | ||
| createdDateTime: assignment.createdDateTime ?? null, | ||
| principalId: assignment.principalId ?? null, | ||
| principalDisplayName: assignment.principalDisplayName ?? null, | ||
| principalType: assignment.principalType ?? null, | ||
| resourceId: assignment.resourceId ?? null, | ||
| resourceDisplayName: assignment.resourceDisplayName ?? null, | ||
| }, | ||
| }, | ||
| } | ||
| }, | ||
| outputs: { | ||
| assignment: { | ||
| type: 'object', | ||
| description: 'The created app role assignment', | ||
| properties: APP_ROLE_ASSIGNMENT_OUTPUT_PROPERTIES, | ||
| }, | ||
| }, | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.