From 195142a591022191ea0b97a808e337dfb1b6cb43 Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Fri, 19 Jan 2024 08:12:57 -0500 Subject: [PATCH 1/2] Fixes for SPOSharingSettings --- CHANGELOG.md | 3 +++ .../MSFT_SPOSharingSettings.psm1 | 4 +++ .../3-Remove.ps1 | 26 ------------------- 3 files changed, 7 insertions(+), 26 deletions(-) delete mode 100644 Modules/Microsoft365DSC/Examples/Resources/AADAuthenticationMethodPolicyEmail/3-Remove.ps1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 78bafaa588..bad7eb5a77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,9 @@ * Removed the ability to specify a value of Absent for the Ensure property. * AADCrossTenantAccessPolicyCOnfigurationDefault * Removed the ability to specify a value of Absent for the Ensure property. +* SPOSharingSettings + * Fixed an Issue where the MySiteSharingCapability could be returned as an + empty string instead of a null value from the Get method. # 1.24.117.1 diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSharingSettings/MSFT_SPOSharingSettings.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSharingSettings/MSFT_SPOSharingSettings.psm1 index a60538c49d..33916b54fb 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSharingSettings/MSFT_SPOSharingSettings.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSharingSettings/MSFT_SPOSharingSettings.psm1 @@ -194,6 +194,10 @@ function Get-TargetResource $DefaultLinkPermission = $SPOSharingSettings.DefaultLinkPermission } + if ([System.String]::IsNullOrEmpty($MySiteSharingCapability)) + { + $MySiteSharingCapability = $null + } return @{ IsSingleInstance = 'Yes' SharingCapability = $SPOSharingSettings.SharingCapability diff --git a/Modules/Microsoft365DSC/Examples/Resources/AADAuthenticationMethodPolicyEmail/3-Remove.ps1 b/Modules/Microsoft365DSC/Examples/Resources/AADAuthenticationMethodPolicyEmail/3-Remove.ps1 deleted file mode 100644 index 6ca6f1913c..0000000000 --- a/Modules/Microsoft365DSC/Examples/Resources/AADAuthenticationMethodPolicyEmail/3-Remove.ps1 +++ /dev/null @@ -1,26 +0,0 @@ -<# -This example is used to test new resources and showcase the usage of new resources being worked on. -It is not meant to use as a production baseline. -#> - -Configuration Example -{ - param - ( - [Parameter(Mandatory = $true)] - [PSCredential] - $credsCredential - ) - Import-DscResource -ModuleName Microsoft365DSC - - Node localhost - { - AADAuthenticationMethodPolicyEmail "AADAuthenticationMethodPolicyEmail-Email" - { - Ensure = "Absent"; - Id = "Email"; - State = "disabled"; # Updated Property - Credential = $credsCredential; - } - } -} From bda68c7e92aa25518eefc4e6bb3efdd04f82f7ce Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Fri, 19 Jan 2024 08:21:29 -0500 Subject: [PATCH 2/2] Update MSFT_SPOSharingSettings.psm1 --- .../MSFT_SPOSharingSettings.psm1 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSharingSettings/MSFT_SPOSharingSettings.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSharingSettings/MSFT_SPOSharingSettings.psm1 index 33916b54fb..b8dd694459 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSharingSettings/MSFT_SPOSharingSettings.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_SPOSharingSettings/MSFT_SPOSharingSettings.psm1 @@ -193,15 +193,9 @@ function Get-TargetResource { $DefaultLinkPermission = $SPOSharingSettings.DefaultLinkPermission } - - if ([System.String]::IsNullOrEmpty($MySiteSharingCapability)) - { - $MySiteSharingCapability = $null - } - return @{ + $results = @{ IsSingleInstance = 'Yes' SharingCapability = $SPOSharingSettings.SharingCapability - MySiteSharingCapability = $MySiteSharingCapability ShowEveryoneClaim = $SPOSharingSettings.ShowEveryoneClaim ShowAllUsersClaim = $SPOSharingSettings.ShowAllUsersClaim ShowEveryoneExceptExternalUsersClaim = $SPOSharingSettings.ShowEveryoneExceptExternalUsersClaim @@ -233,6 +227,12 @@ function Get-TargetResource Managedidentity = $ManagedIdentity.IsPresent Ensure = 'Present' } + + if (-not [System.String]::IsNullOrEmpty($MySiteSharingCapability)) + { + $results.Add('MySiteSharingCapability', $MySiteSharingCapability) + } + return $results } catch {