From 21ae7440d5086d999474c5c074a525fe82462543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A5re=20Overg=C3=A5rd?= Date: Fri, 3 Apr 2026 18:48:58 +0200 Subject: [PATCH 1/2] Fix name, add output type --- .../{Split-ArrayIntoChunks.ps1 => Split-ArrayIntoChunk.ps1} | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) rename EntraReporter/internal/functions/{Split-ArrayIntoChunks.ps1 => Split-ArrayIntoChunk.ps1} (91%) diff --git a/EntraReporter/internal/functions/Split-ArrayIntoChunks.ps1 b/EntraReporter/internal/functions/Split-ArrayIntoChunk.ps1 similarity index 91% rename from EntraReporter/internal/functions/Split-ArrayIntoChunks.ps1 rename to EntraReporter/internal/functions/Split-ArrayIntoChunk.ps1 index fe6234c..702ec3e 100644 --- a/EntraReporter/internal/functions/Split-ArrayIntoChunks.ps1 +++ b/EntraReporter/internal/functions/Split-ArrayIntoChunk.ps1 @@ -16,15 +16,16 @@ A list of object arrays, where each array is a chunk from the original input. .EXAMPLE - Split-ArrayIntoChunks -InputObject @(1,2,3,4,5) -ChunkSize 2 + Split-ArrayIntoChunk -InputObject @(1,2,3,4,5) -ChunkSize 2 Returns chunks: @(1,2), @(3,4), @(5) .NOTES Used by EntraReporter helpers for batching Graph requests. #> -function Split-ArrayIntoChunks { +function Split-ArrayIntoChunk { [CmdletBinding()] + [OutputType([System.Array])] param( [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] From 754590d399e10c242f84ab76dc2beea9ae37c323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A5re=20Overg=C3=A5rd?= Date: Fri, 3 Apr 2026 18:49:24 +0200 Subject: [PATCH 2/2] Add output type --- EntraReporter/functions/Get-EntraIdRoleAssignment.ps1 | 2 ++ .../internal/functions/Get-EntraIdGroupScheduleBatch.ps1 | 3 ++- EntraReporter/internal/functions/Invoke-GraphPaged.ps1 | 5 ++++- EntraReporter/internal/functions/Test-GraphConnection.ps1 | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/EntraReporter/functions/Get-EntraIdRoleAssignment.ps1 b/EntraReporter/functions/Get-EntraIdRoleAssignment.ps1 index c5b21d8..264ccdb 100644 --- a/EntraReporter/functions/Get-EntraIdRoleAssignment.ps1 +++ b/EntraReporter/functions/Get-EntraIdRoleAssignment.ps1 @@ -27,6 +27,7 @@ #> function Get-EntraIdRoleAssignment { [CmdletBinding()] + [OutputType([PSCustomObject[]])] param( [Parameter()] [string[]] @@ -82,6 +83,7 @@ function Get-EntraIdRoleAssignment { # New-RoleAssignmentEntry: build and normalize a role assignment output record function New-RoleAssignmentEntry { + [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '', Justification = 'Doesnt really change state, just normalizes output')] [CmdletBinding()] param( [Parameter(Mandatory)] [string]$RoleId, # Role definition ID diff --git a/EntraReporter/internal/functions/Get-EntraIdGroupScheduleBatch.ps1 b/EntraReporter/internal/functions/Get-EntraIdGroupScheduleBatch.ps1 index 5293eac..93bff02 100644 --- a/EntraReporter/internal/functions/Get-EntraIdGroupScheduleBatch.ps1 +++ b/EntraReporter/internal/functions/Get-EntraIdGroupScheduleBatch.ps1 @@ -28,6 +28,7 @@ #> function Get-EntraIdGroupScheduleBatch { + [CmdletBinding()] param( # Array of Azure AD group IDs to fetch schedules for [Parameter(Mandatory = $true)] @@ -54,7 +55,7 @@ function Get-EntraIdGroupScheduleBatch { } # Split the GroupId array into chunks of 20 for batch processing (Graph API batch limit optimization) - $chunks = Split-ArrayIntoChunks -InputObject $GroupId -ChunkSize 20 + $chunks = Split-ArrayIntoChunk -InputObject $GroupId -ChunkSize 20 # Process each chunk through the Graph batch API and collect all responses $allResponses = foreach ($chunk in $chunks) { diff --git a/EntraReporter/internal/functions/Invoke-GraphPaged.ps1 b/EntraReporter/internal/functions/Invoke-GraphPaged.ps1 index c2a510e..59f55f2 100644 --- a/EntraReporter/internal/functions/Invoke-GraphPaged.ps1 +++ b/EntraReporter/internal/functions/Invoke-GraphPaged.ps1 @@ -21,8 +21,11 @@ Uses Invoke-MgGraphRequest to perform each request and expects standard Graph pagination (`@odata.nextLink`). #> function Invoke-GraphPaged { + [CmdletBinding()] + [OutputType([System.Object[]])] param( - [Parameter(Mandatory)][string] $Uri + [Parameter(Mandatory)] + [string]$Uri ) $items = @() $next = $Uri diff --git a/EntraReporter/internal/functions/Test-GraphConnection.ps1 b/EntraReporter/internal/functions/Test-GraphConnection.ps1 index aec16ec..d6fc685 100644 --- a/EntraReporter/internal/functions/Test-GraphConnection.ps1 +++ b/EntraReporter/internal/functions/Test-GraphConnection.ps1 @@ -10,6 +10,7 @@ #> function Test-GraphConnection { [CmdletBinding()] + [OutputType([System.Boolean])] param () # Check if Graph module is installed