Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPOSharingSettings: Under certain conditions some properties should be removed from being tested in Test-TargetResource #4649

Closed
ricmestre opened this issue May 8, 2024 · 0 comments · Fixed by #4650 or #4674

Comments

@ricmestre
Copy link
Contributor

Description of the issue

There are some properties that might get exported to a blueprint that don't make sense combined with other properties, this is just how the tenants get setup and not a problem with DSC or PnP, so to workaround this while calling Set-TargetResource there are several ifs to cope with the situation but Test-TargetResource doesn't have these conditions which means that the tenant might be properly setup but will always report it's not since Test-TargetResource will always return false.

Below there's an example where the tenant has the correct SharingCapability setup with ExternalUserSharingOnly but still fails the test because the blueprint also contains property RequireAnonymousLinksExpireInDays which in this case should have been removed from being tested since it only works if SharingCapability is set to ExternalUserAndGuestSharing.

"WARNING: [REDACTED]:  [[SPOSharingSettings]SPOSharingSettings] The sharing capabilities for the tenant are not configured to be ExternalUserAndGuestSharing for that the RequireAnonymousLinksExpireInDays property cannot be configured"

Fix should be something similar to what's already being done on Set-TargetResource but apply it on Test-TargetResource, I'll work on a PR to fix this.

Microsoft 365 DSC Version

1.24.424.1

Which workloads are affected

SharePoint Online

The DSC configuration

SPOSharingSettings "SPOSharingSettings"
        {
            BccExternalSharingInvitations              = $False;
            Credential                                 = $Credscredential;
            DefaultLinkPermission                      = "Edit";
            DefaultSharingLinkType                     = "Direct";
            EnableGuestSignInAcceleration              = $False;
            Ensure                                     = "Present";
            ExternalUserExpirationRequired             = $False;
            ExternalUserExpireInDays                   = 60;
            FileAnonymousLinkType                      = "Edit";
            FolderAnonymousLinkType                    = "Edit";
            IsSingleInstance                           = "Yes";
            MySiteSharingCapability                    = "ExternalUserSharingOnly";
            NotifyOwnersWhenItemsReshared              = $True;
            PreventExternalUsersFromResharing          = $True;
            ProvisionSharedWithEveryoneFolder          = $False;
            RequireAcceptingAccountMatchInvitedAccount = $True;
            RequireAnonymousLinksExpireInDays          = 30;
            SharingCapability                          = "ExternalUserSharingOnly";
            SharingDomainRestrictionMode               = "None";
            ShowAllUsersClaim                          = $False;
            ShowEveryoneClaim                          = $False;
            ShowEveryoneExceptExternalUsersClaim       = $True;
            ShowPeoplePickerSuggestionsForGuestUsers   = $False;
        }

Verbose logs showing the problem

WARNING: [REDACTED]:  [[SPOSharingSettings]SPOSharingSettings] The sharing capabilities for the tenant are not configured to be ExternalUserAndGuestSharing for that the RequireAnonymousLinksExpireInDays property cannot be configured

Environment Information + PowerShell Version

N/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant