From 9f415a0633d97975121c0738798c9cddaebb67a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andi=20Kr=C3=BCger?= <15608729+andikrueger@users.noreply.github.com> Date: Wed, 26 Jul 2023 16:44:18 +0200 Subject: [PATCH 1/2] Updated Resources and Cmdlet documentation pages #### Pull Request (PR) description Fixes issues due to MaxFunctionCount in PS5.1 #### This Pull Request (PR) fixes the following issues - Fixes #3454 --- .github/workflows/CodeCoverage.yml | 8 ++++---- .github/workflows/Unit Tests.yml | 8 ++++---- CHANGELOG.md | 4 ++++ Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1 | 12 +++++++++--- Tests/TestHarness.psm1 | 2 +- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/.github/workflows/CodeCoverage.yml b/.github/workflows/CodeCoverage.yml index 656062ed9f..12de9e7d3b 100644 --- a/.github/workflows/CodeCoverage.yml +++ b/.github/workflows/CodeCoverage.yml @@ -25,7 +25,7 @@ jobs: shell: pwsh run: | Import-Module './Tests/TestHarness.psm1' -Force; - $MaximumFunctionCount = 9999 + $MaximumFunctionCount = 32767 try { @@ -33,7 +33,7 @@ jobs: } catch { - $MaximumFunctionCount = 9999 + $MaximumFunctionCount = 32767 Import-Module './Tests/TestHarness.psm1' -Force; $results = Invoke-QualityChecksHarness } @@ -45,7 +45,7 @@ jobs: shell: pwsh run: | Import-Module './Tests/TestHarness.psm1' -Force; - $MaximumFunctionCount = 9999 + $MaximumFunctionCount = 32767 try { @@ -53,7 +53,7 @@ jobs: } catch { - $MaximumFunctionCount = 9999 + $MaximumFunctionCount = 32767 Import-Module './Tests/TestHarness.psm1' -Force; $results = Invoke-TestHarness } diff --git a/.github/workflows/Unit Tests.yml b/.github/workflows/Unit Tests.yml index 21ba42fd4b..5276499448 100644 --- a/.github/workflows/Unit Tests.yml +++ b/.github/workflows/Unit Tests.yml @@ -27,7 +27,7 @@ jobs: shell: pwsh run: | Import-Module './Tests/TestHarness.psm1' -Force; - $MaximumFunctionCount = 9999 + $MaximumFunctionCount = 32767 try { @@ -35,7 +35,7 @@ jobs: } catch { - $MaximumFunctionCount = 9999 + $MaximumFunctionCount = 32767 Import-Module './Tests/TestHarness.psm1' -Force; $results = Invoke-QualityChecksHarness } @@ -47,7 +47,7 @@ jobs: shell: pwsh run: | Import-Module './Tests/TestHarness.psm1' -Force; - $MaximumFunctionCount = 9999 + $MaximumFunctionCount = 32767 try { @@ -55,7 +55,7 @@ jobs: } catch { - $MaximumFunctionCount = 9999 + $MaximumFunctionCount = 32767 Import-Module './Tests/TestHarness.psm1' -Force; $results = Invoke-TestHarness -IgnoreCodeCoverage } diff --git a/CHANGELOG.md b/CHANGELOG.md index f3e7f7d3a2..bb2367b54a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,13 @@ # Change log for Microsoft365DSC # UNRELEASED + * AADGroup * Fix issue setting MemberOf property. FIXES [#3496](https://github.com/microsoft/Microsoft365DSC/issues/3496) +* MISC + * Improved Update-M365DSCDependencies function to properly install all Microsoft.Graph.*M modules. + FIXES [#3454](https://github.com/microsoft/Microsoft365DSC/issues/3454) # 1.23.719.1 diff --git a/Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1 b/Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1 index 9c98de1707..d28556058d 100644 --- a/Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1 +++ b/Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1 @@ -1155,7 +1155,7 @@ function Export-M365DSCConfiguration $Validate ) - $Global:MaximumFunctionCount = 16000 + $Global:MaximumFunctionCount = 32767 # Define the exported resource instances' names Global variable $Global:M365DSCExportedResourceInstancesNames = @() @@ -1661,7 +1661,7 @@ function New-M365DSCConnection $SkipModuleReload = $false ) - $Global:MaximumFunctionCount = 16000 + $Global:MaximumFunctionCount = 32767 if ($Workload -eq 'MicrosoftTeams') { @@ -2757,6 +2757,7 @@ function Update-M365DSCDependencies $ValidateOnly ) + $Global:MaximumFunctionCount = 32767 $InformationPreference = 'Continue' $currentPath = Join-Path -Path $PSScriptRoot -ChildPath '..\' -Resolve @@ -2782,8 +2783,12 @@ function Update-M365DSCDependencies { Write-Information -MessageData "Installing $($dependency.ModuleName) version {$($dependency.RequiredVersion)}" Remove-Module $dependency.ModuleName -Force -ErrorAction SilentlyContinue + if ($dependency.ModuleName -like 'Microsoft.Graph*') + { + Remove-Module 'Microsoft.Graph.Authentication' -Force -ErrorAction SilentlyContinue + } + Remove-Module $dependency.ModuleName -Force -ErrorAction SilentlyContinue Install-Module $dependency.ModuleName -RequiredVersion $dependency.RequiredVersion -AllowClobber -Force -Scope 'AllUsers' - Import-Module $dependency.ModuleName -Force } else { @@ -2801,6 +2806,7 @@ function Update-M365DSCDependencies Write-Host "Could not update or import {$($dependency.ModuleName)}" Write-Host "Error-Mesage: $($_.Exception.Message)" } + $i++ } diff --git a/Tests/TestHarness.psm1 b/Tests/TestHarness.psm1 index 36222dc7f9..0d93e4c7f9 100644 --- a/Tests/TestHarness.psm1 +++ b/Tests/TestHarness.psm1 @@ -18,7 +18,7 @@ function Invoke-TestHarness $sw = [System.Diagnostics.StopWatch]::startnew() - $MaximumFunctionCount = 9999 + $MaximumFunctionCount = 32767 Write-Host -Object 'Running all Microsoft365DSC Unit Tests' $repoDir = Join-Path -Path $PSScriptRoot -ChildPath '..\' -Resolve From 2f1b56228ceb4427c7fedad56852c825f00995d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andi=20Kr=C3=BCger?= <15608729+andikrueger@users.noreply.github.com> Date: Wed, 26 Jul 2023 16:47:26 +0200 Subject: [PATCH 2/2] typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb2367b54a..6048fe6082 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ * Fix issue setting MemberOf property. FIXES [#3496](https://github.com/microsoft/Microsoft365DSC/issues/3496) * MISC - * Improved Update-M365DSCDependencies function to properly install all Microsoft.Graph.*M modules. + * Improved Update-M365DSCDependencies function to properly install all Microsoft.Graph.* modules. FIXES [#3454](https://github.com/microsoft/Microsoft365DSC/issues/3454) # 1.23.719.1