dsccommunity / SharePointDsc

The SharePointDsc PowerShell module provides DSC resources that can be used to deploy and manage a SharePoint farm
MIT License
246 stars 107 forks source link

SPWebAppPolicy: arry of Members delimited with "," or not? #1375

Closed bartvermeersch closed 2 years ago

bartvermeersch commented 2 years ago

Tested on PS5.1 with SharePointDSC v5.0.0

The list of Members in an SPWebAppPolicy throws an error when it is delimited with an "," while ReverseDSC does put an "," delimiter between the Members. Either reverseDSC or DSC contains a bug.

Output from ReverseDSC:

    SPWebAppPolicy 053f1e72-e106-0000-0000-5783a3759000
    {
        Members                = @(
            MSFT_SPWebPolicyPermissions {
                Username = $xx.UserName
                IdentityType = 'Native'
                PermissionLevel = 'Full Read'
                ActAsSystemAccount = $False
            },
            MSFT_SPWebPolicyPermissions {
                Username =  $xx.UserName
                IdentityType = 'Claims'
                PermissionLevel = 'Full Read'
                ActAsSystemAccount = $False
            },
            MSFT_SPWebPolicyPermissions {
                Username =  $xx.UserName
                IdentityType = 'Claims'
                PermissionLevel = 'Full Read'
                ActAsSystemAccount = $False
            });
        PsDscRunAsCredential   = $xx;
        SetCacheAccountsPolicy = $False;
        WebAppUrl              = "https://xx/";
    }

This throws an error because of the "," delimiter, removing the "," solves the issue:

SPWebAppPolicy WebAppPolicy { WebAppUrl = "http://sharepoint.contoso.com" Members = @( MSFT_SPWebPolicyPermissions { Username = "contoso\user1" PermissionLevel = "Full Control" ActAsSystemAccount = $true ==> }, MSFT_SPWebPolicyPermissions { Username = "contoso\Group 1" PermissionLevel = "Full Read" IdentityType = "Claims" } ) PsDscRunAsCredential = $SetupAccount }

The error: At line:1295 char:19

ykuijs commented 2 years ago

Have tracked this issue back to an issue in ReverseDsc. Am working on fixing that, before I can update the required version in SPDsc.

ykuijs commented 2 years ago

Fixed in ReverseDsc v2.0.0.10 via PR [microsoft/ReverseDSC#25].

Working on the PR for SPDsc to use this version now.