From 26abeb3b3dc4846fc862bf2b48782156974e2248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andi=20Kr=C3=BCger?= <15608729+andikrueger@users.noreply.github.com> Date: Wed, 14 Feb 2024 21:19:54 +0100 Subject: [PATCH] SPOSharingSettings: Multiple sites returned from Get-PnPTenantSite Fixes #2759 --- CHANGELOG.md | 3 +++ .../MSFT_SPOSharingSettings/MSFT_SPOSharingSettings.psm1 | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ba895ab13..0ccb99ff9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,9 @@ * Fix typo in variable which made it export incorrectly and report that resource was not in correct state due to testing an incorrect value FIXES [#3972](https://github.com/microsoft/Microsoft365DSC/issues/3972) +* SPOSharingSettings + * Fixed an issue where the resource would return multiple sites. + FIXES [#2759](https://github.com/microsoft/Microsoft365DSC/issues/2759) * DEPENDENCIES * Updated DSCParser to version 1.4.0.2. * Updated Microsoft.Graph dependencies to version 2.13.1. diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSharingSettings/MSFT_SPOSharingSettings.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSharingSettings/MSFT_SPOSharingSettings.psm1 index b8dd694459..b8c873870f 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSharingSettings/MSFT_SPOSharingSettings.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSharingSettings/MSFT_SPOSharingSettings.psm1 @@ -520,7 +520,7 @@ function Set-TargetResource Set-PnPTenant @CurrentParameters | Out-Null if ($SetMySharingCapability) { - $mysite = Get-PnPTenantSite | Where-Object { $_.Url -match '-my.sharepoint.com/' } + $mysite = Get-PnPTenantSite | Where-Object { $_.Url -match '-my.sharepoint.com/' -and $_.Template -notmatch '^RedirectSite#' } Set-PnPTenantSite -Identity $mysite.Url -SharingCapability $MySiteSharingCapability } }