Skip to content

Merge pull request KelvinTegelaar#1561 from KelvinTegelaar/dev#1

Open
renada-jacob wants to merge 726 commits intodevfrom
refactor-offboarding-webhook-structure
Open

Merge pull request KelvinTegelaar#1561 from KelvinTegelaar/dev#1
renada-jacob wants to merge 726 commits intodevfrom
refactor-offboarding-webhook-structure

Conversation

@renada-jacob
Copy link
Copy Markdown
Owner

No description provided.

KelvinTegelaar and others added 30 commits October 17, 2025 10:15
Feat: Add support for setting group visibility in Microsoft 365 groups
add pagination and return deltaLink with combined results
Clean up logging and add more error data
Fixes KelvinTegelaar/CIPP#4843
add delta query support to scheduler
JohnDuprey and others added 27 commits November 21, 2025 10:28
Renamed 'Standard' field to 'Template' in $StandardInfo and added 'Standard' from $Row. Changed output object field 'Standard' to 'StandardInfo' for clarity and consistency.
Replaced inconsistent usage of $tenant and $Tenant variables with $TenantFilter in Write-LogMessage and New-GraphPostRequest calls to ensure correct tenant context throughout New-CIPPCAPolicy.ps1.
Wrapped the retrieval of tenant capabilities and SKUId in a try-catch block to log errors and provide better diagnostics when fetching capabilities fails. Also added logging for errors when fetching tenant variables.
Introduced a $maxRetries parameter and implemented retry logic with exponential backoff for failed requests in New-GraphPOSTRequest. This improves reliability when transient errors occur during REST API calls.
Introduces Get-CIPPTextReplacement to process $HTMLContent and $JSONContent with tenant-specific replacements before sending alerts. Ensures dynamic content personalization for both email and webhook notifications.
Set extensionBundle version to start from 4.26.0. Added DurableTask defaultVersion, versionMatchStrategy, and versionFailureStrategy for stricter version control.
Refactored logging to use headers instead of user principal, improved app registration handling for partner tenants, and updated response structure for better error and success reporting. Added logic to copy app registrations between tenants and create service principals as needed.
Replaces 'severity' with 'state' and 'message' with 'resultText' in result objects for Invoke-ExecApiClient.ps1 and Invoke-ExecUpdateRefreshToken.ps1. Also updates error handling in Invoke-ExecUpdateRefreshToken.ps1 for consistency.
Introduced a Write-LogMessage call to log the evaluation of tenants for each group, improving traceability and debugging of dynamic tenant group conditions.
Introduces script-level ScheduledTaskId variable in Push-ExecScheduledCommand and ensures its cleanup. Updates Write-LogMessage to include ScheduledTaskId in log entries. Enhances Invoke-ListLogs to support filtering by ScheduledTaskId, improving traceability of scheduled tasks in logs. Also adds cleanup for StandardInfo variable in Push-CIPPStandard.
Bumped the default version and latest version reference from 8.7.0 to 8.7.1 in host.json and version_latest.txt to reflect the new release.
Fix: Enhance Set-CIPPMessageCopy to support SendOnBehalf
Updated Invoke-ListLogs.ps1 to require $StandardTaskFilter to be set before processing rows with StandardTemplateId. This change ensures standard template filtering only occurs when explicitly requested.
Feat: Add support for assigning apps to custom groups
…nd proper result handling

- Consolidate all results into single object with clean key names

- Handle array vs single-value results appropriately

- Fix loop-based actions to collect all results
Copilot AI review requested due to automatic review settings November 25, 2025 16:21
Copy link
Copy Markdown

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

This PR merges changes from the dev branch, implementing a comprehensive refactoring of HTTP response handling and introducing new features for Exchange administration, tenant group management, and scheduler functionality.

Key Changes

  • Replaced Push-OutputBinding with return statements across all HTTP functions for cleaner response handling
  • Added new mailbox retention policy management features with bulk operation support
  • Implemented dynamic tenant group rules with support for custom variables and automatic membership updates
  • Enhanced scheduler functionality with better trigger handling and search capabilities
  • Improved error handling with Get-CippException wrapper for normalized error messages

Reviewed changes

Copilot reviewed 259 out of 1095 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
Invoke-ExecMailTest.ps1 Removed debug logging and replaced Push-OutputBinding with return
Invoke-ExecManageRetentionTags.ps1 New endpoint for managing Exchange retention policy tags with validation
Invoke-ExecManageRetentionPolicies.ps1 New endpoint for managing retention policies with tag relationships
Invoke-ExecSetMailboxRetentionPolicies.ps1 New endpoint for bulk-applying retention policies to mailboxes
Invoke-ExecModifyMBPerms.ps1 Major refactor to support bulk mailbox permission changes with GUID mapping
Invoke-ListMailboxRules.ps1 Added QueueId metadata and improved filtering logic
Invoke-ListMailboxes.ps1 Added RetentionPolicy to mailbox list output
Invoke-AddTenantAllowBlockList.ps1 Enhanced tenant handling and improved error reporting
Invoke-ExecTenantGroup.ps1 Added dynamic group support with rule evaluation
Invoke-ListCustomVariables.ps1 New endpoint for managing custom text replacement variables
Invoke-ExecCustomRole.ps1 Added role cloning and enhanced role management features
Invoke-ListScheduledItems.ps1 Added trigger deserialization and search functionality
Comments suppressed due to low confidence (4)

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Contacts/Invoke-ListContactTemplates.ps1:45

  • Redundant return statement on line 45 after returning HttpResponseContext on lines 41-44.
            return ([HttpResponseContext]@{
                StatusCode = [HttpStatusCode]::NotFound
                Body       = @{ Error = "Template with ID $RequestedID not found" }
            })
            return

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecCippReplacemap.ps1:27

  • Redundant return statement on line 27 after returning HttpResponseContext on lines 23-26.
        return ([HttpResponseContext]@{
                StatusCode = [HttpStatusCode]::BadRequest
                Body       = 'customerId is required'
            })
        return

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Scheduler/Invoke-ListScheduledItemDetails.ps1:21

  • Redundant return statement on line 21 after returning HttpResponseContext on lines 17-20.
        return ([HttpResponseContext]@{
                StatusCode = [HttpStatusCode]::BadRequest
                Body       = "Required parameter 'RowKey' is missing"
            })
        return

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Scheduler/Invoke-ListScheduledItemDetails.ps1:33

  • Redundant return statement on line 33 after returning HttpResponseContext on lines 29-32.
        return ([HttpResponseContext]@{
                StatusCode = [HttpStatusCode]::NotFound
                Body       = "Task with RowKey '$RowKey' not found"
            })
        return

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +19 to +23
return ([HttpResponseContext]@{
StatusCode = [HttpStatusCode]::BadRequest
Body = "Tenant filter is required"
})
return
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

Redundant return statement on line 23 after returning HttpResponseContext on lines 19-22.

Copilot uses AI. Check for mistakes.
StatusCode = [HttpStatusCode]::BadRequest
Body = "PolicyName is required"
})
return
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

Redundant return statement on line 36 after returning HttpResponseContext on lines 32-35.

Suggested change
return

Copilot uses AI. Check for mistakes.
StatusCode = [HttpStatusCode]::BadRequest
Body = "Mailboxes array is required"
})
return
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

Redundant return statement on line 44 after returning HttpResponseContext on lines 40-43.

Suggested change
return

Copilot uses AI. Check for mistakes.
StatusCode = [HttpStatusCode]::BadRequest
Body = "Tenant filter is required"
})
return
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

Redundant return statement on line 23 after returning HttpResponseContext on lines 19-22.

Suggested change
return

Copilot uses AI. Check for mistakes.
StatusCode = [HttpStatusCode]::BadRequest
Body = "Tenant filter is required"
})
return
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

Redundant return statement on line 23 after returning HttpResponseContext on lines 19-22.

Suggested change
return

Copilot uses AI. Check for mistakes.
StatusCode = [HttpStatusCode]::NotFound
Body = @{'Results' = @("Failed to get user ID: $($ErrorMessage.NormalizedError)") }
})
return
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

Redundant return statement on line 46 after returning HttpResponseContext on lines 42-45.

Suggested change
return

Copilot uses AI. Check for mistakes.
Comment on lines +24 to 28
return ([HttpResponseContext]@{
StatusCode = [HttpStatusCode]::BadRequest
Body = $Body
Body = @{'Results' = @('Username is required') }
})
return
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

Redundant return statement on line 28 after returning HttpResponseContext on lines 24-27.

Copilot uses AI. Check for mistakes.
Body = $Body
Body = @{'Results' = @("Failed to get user ID: $($ErrorMessage.NormalizedError)") }
})
return
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

Redundant return statement on line 46 after returning HttpResponseContext on lines 42-45.

Suggested change
return

Copilot uses AI. Check for mistakes.
Comment on lines +28 to +31
return ([HttpResponseContext]@{
StatusCode = [HttpStatusCode]::Forbidden
Body = @{ Results = 'You do not have permission to manage tenant groups.' }
})
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

Redundant closing brace on line 32 after early return. The return statement on lines 28-31 exits the function, so the closing brace appears unnecessary unless there's missing code logic.

Copilot uses AI. Check for mistakes.
StatusCode = [HttpStatusCode]::BadRequest
Body = 'tenantFilter is required'
})
}
Copy link

Copilot AI Nov 25, 2025

Choose a reason for hiding this comment

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

Redundant closing brace on line 24 after early return. The return statement exits the function, making the closing brace unnecessary.

Suggested change
}

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

9 participants