Merge pull request KelvinTegelaar#1561 from KelvinTegelaar/dev#1
Merge pull request KelvinTegelaar#1561 from KelvinTegelaar/dev#1renada-jacob wants to merge 726 commits intodevfrom
Conversation
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
Fix: Remove wrong license check
add delta query support to scheduler
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.
…it behaves like the standard does
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.
Update Invoke-AddEditTransportRule.ps1
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.
…deduplication logic
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
There was a problem hiding this comment.
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-OutputBindingwithreturnstatements 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-CippExceptionwrapper 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
returnstatement 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
returnstatement 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
returnstatement 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
returnstatement 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.
| return ([HttpResponseContext]@{ | ||
| StatusCode = [HttpStatusCode]::BadRequest | ||
| Body = "Tenant filter is required" | ||
| }) | ||
| return |
There was a problem hiding this comment.
Redundant return statement on line 23 after returning HttpResponseContext on lines 19-22.
| StatusCode = [HttpStatusCode]::BadRequest | ||
| Body = "PolicyName is required" | ||
| }) | ||
| return |
There was a problem hiding this comment.
Redundant return statement on line 36 after returning HttpResponseContext on lines 32-35.
| return |
| StatusCode = [HttpStatusCode]::BadRequest | ||
| Body = "Mailboxes array is required" | ||
| }) | ||
| return |
There was a problem hiding this comment.
Redundant return statement on line 44 after returning HttpResponseContext on lines 40-43.
| return |
| StatusCode = [HttpStatusCode]::BadRequest | ||
| Body = "Tenant filter is required" | ||
| }) | ||
| return |
There was a problem hiding this comment.
Redundant return statement on line 23 after returning HttpResponseContext on lines 19-22.
| return |
| StatusCode = [HttpStatusCode]::BadRequest | ||
| Body = "Tenant filter is required" | ||
| }) | ||
| return |
There was a problem hiding this comment.
Redundant return statement on line 23 after returning HttpResponseContext on lines 19-22.
| return |
| StatusCode = [HttpStatusCode]::NotFound | ||
| Body = @{'Results' = @("Failed to get user ID: $($ErrorMessage.NormalizedError)") } | ||
| }) | ||
| return |
There was a problem hiding this comment.
Redundant return statement on line 46 after returning HttpResponseContext on lines 42-45.
| return |
| return ([HttpResponseContext]@{ | ||
| StatusCode = [HttpStatusCode]::BadRequest | ||
| Body = $Body | ||
| Body = @{'Results' = @('Username is required') } | ||
| }) | ||
| return |
There was a problem hiding this comment.
Redundant return statement on line 28 after returning HttpResponseContext on lines 24-27.
| Body = $Body | ||
| Body = @{'Results' = @("Failed to get user ID: $($ErrorMessage.NormalizedError)") } | ||
| }) | ||
| return |
There was a problem hiding this comment.
Redundant return statement on line 46 after returning HttpResponseContext on lines 42-45.
| return |
| return ([HttpResponseContext]@{ | ||
| StatusCode = [HttpStatusCode]::Forbidden | ||
| Body = @{ Results = 'You do not have permission to manage tenant groups.' } | ||
| }) |
There was a problem hiding this comment.
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.
| StatusCode = [HttpStatusCode]::BadRequest | ||
| Body = 'tenantFilter is required' | ||
| }) | ||
| } |
There was a problem hiding this comment.
Redundant closing brace on line 24 after early return. The return statement exits the function, making the closing brace unnecessary.
| } |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.