Microsoft365DSC icon indicating copy to clipboard operation
Microsoft365DSC copied to clipboard

TeamsClientConfiguration: Applying DSC config crashes when RestrictedSenderList is used

Open EricHindrichsen opened this issue 5 years ago • 3 comments

Details of the scenario you tried and the problem that is occurring

Hi,

we are trying to configure a list of allowed domains for sending e-mails to channels in MS Teams via M365DSC and the "RestrictedSenderList" setting. First we checked the documentation for the module, but the documentation contradicts itself: The expected type is stated as string array, but the description states that "a comma-separated string" is expected. We went ahead and tried the following notations for that setting: String array: @("<redacted1>.de", "<redacted2>.de") Comma-separated string: "<redacted1>.de,<redacted2>.de" Semicolon-separated string: "<redacted1>.de;<redacted2>.de" Space-separated string: "<redacted1>.de <redacted2>.de"

We also tried using a single string: "<redacted1>.de"

Each and every time the process applying the config via DSC will fail when this module is executed. The error message is always a variation of Cannot convert '<redacted1>.de <redacted2>.de' to the type 'System.String' required by parameter 'RestrictedSenderList'. Specified method is not supported. with <redacted1>.de <redacted2>.de being replaced by the notation we used for the setting.

We tested the underlying Set-CsTeamsClientConfiguration cmdlet. It didn't accept a string array, but it worked fine with a single comma-/semicolon-/space-separated string listing all domains.

Verbose logs showing the problem

2021-05-03T12:21:16.1675816Z VERBOSE: [fv-az183-93]: LCM:  [ Start  Resource ]  [[TeamsClientConfiguration]a0a3947d-6a39-4049-81c1-22f8e949bbc1]
2021-05-03T12:21:16.1683544Z VERBOSE: [fv-az183-93]: LCM:  [ Start  Test     ]  [[TeamsClientConfiguration]a0a3947d-6a39-4049-81c1-22f8e949bbc1]
2021-05-03T12:21:16.1687706Z VERBOSE: [fv-az183-93]:                            [[TeamsClientConfiguration]a0a3947d-6a39-4049-81c1-22f8e949bbc1] 
2021-05-03T12:21:16.1692818Z Importing the module MSFT_TeamsClientConfiguration in force mode.
2021-05-03T12:21:16.1826648Z VERBOSE: [fv-az183-93]:                            [[TeamsClientConfiguration]a0a3947d-6a39-4049-81c1-22f8e949bbc1] 
2021-05-03T12:21:16.1831885Z Testing configuration of Teams Client
2021-05-03T12:21:16.1891253Z VERBOSE: [fv-az183-93]:                            [[TeamsClientConfiguration]a0a3947d-6a39-4049-81c1-22f8e949bbc1] 
2021-05-03T12:21:16.1896355Z Getting configuration of Teams Client
2021-05-03T12:21:22.4055670Z VERBOSE: [fv-az183-93]:                            [[TeamsClientConfiguration]a0a3947d-6a39-4049-81c1-22f8e949bbc1] 
2021-05-03T12:21:22.4064014Z Current Values: AllowBox=False; AllowDropBox=False; AllowEgnyte=False; AllowEmailIntoChannel=True; 
2021-05-03T12:21:22.4068371Z AllowGoogleDrive=False; AllowGuestUser=True; AllowOrganizationTab=False; AllowResourceAccountSendMessage=True; 
2021-05-03T12:21:22.4076076Z AllowScopedPeopleSearchandAccess=False; AllowShareFile=False; AllowSkypeBusinessInterop=True; 
2021-05-03T12:21:22.4080255Z ContentPin=RequiredOutsideScheduleMeeting; GlobalAdminAccount=System.Management.Automation.PSCredential; 
2021-05-03T12:21:22.4087858Z Identity=Global; ResourceAccountContentAccess=NoAccess; RestrictedSenderList=$null
2021-05-03T12:21:22.4093681Z VERBOSE: [fv-az183-93]:                            [[TeamsClientConfiguration]a0a3947d-6a39-4049-81c1-22f8e949bbc1] 
2021-05-03T12:21:22.4102698Z Target Values: AllowBox=False; AllowDropBox=False; AllowEgnyte=False; AllowEmailIntoChannel=True; 
2021-05-03T12:21:22.4107210Z AllowGoogleDrive=False; AllowGuestUser=True; AllowOrganizationTab=False; AllowResourceAccountSendMessage=True; 
2021-05-03T12:21:22.4114852Z AllowScopedPeopleSearchandAccess=False; AllowShareFile=False; AllowSkypeBusinessInterop=True; 
2021-05-03T12:21:22.4119068Z ContentPin=RequiredOutsideScheduleMeeting; GlobalAdminAccount=System.Management.Automation.PSCredential; 
2021-05-03T12:21:22.4126759Z Identity=Global; ResourceAccountContentAccess=NoAccess; RestrictedSenderList=(<redacted1>.de,<redacted2>.de); 
2021-05-03T12:21:22.4129774Z Verbose=True
2021-05-03T12:21:23.0444114Z VERBOSE: [fv-az183-93]:                            [[TeamsClientConfiguration]a0a3947d-6a39-4049-81c1-22f8e949bbc1] 
2021-05-03T12:21:23.0453977Z Test-TargetResource returned False
2021-05-03T12:21:23.0459129Z VERBOSE: [fv-az183-93]: LCM:  [ End    Test     ]  [[TeamsClientConfiguration]a0a3947d-6a39-4049-81c1-22f8e949bbc1]  in
2021-05-03T12:21:23.0471951Z  6.8350 seconds.
2021-05-03T12:21:23.0480040Z VERBOSE: [fv-az183-93]: LCM:  [ Start  Set      ]  [[TeamsClientConfiguration]a0a3947d-6a39-4049-81c1-22f8e949bbc1]
2021-05-03T12:21:23.0484519Z VERBOSE: [fv-az183-93]:                            [[TeamsClientConfiguration]a0a3947d-6a39-4049-81c1-22f8e949bbc1] 
2021-05-03T12:21:23.0505426Z Importing the module MSFT_TeamsClientConfiguration in force mode.
2021-05-03T12:21:23.0512367Z VERBOSE: [fv-az183-93]:                            [[TeamsClientConfiguration]a0a3947d-6a39-4049-81c1-22f8e949bbc1] 
2021-05-03T12:21:23.0517477Z Setting configuration of Teams Client
2021-05-03T12:21:29.5897026Z [Invoke-DscConfiguration.ps1] Failed to apply dsc configuration. [Cannot convert '<redacted1>.de <redacted2>.de' to the type 'System.String' required by parameter 'RestrictedSenderList'. Specified method is not supported.]
2021-05-03T12:21:30.4820620Z [Get-DscEvents] Configuration item: 'MSFT_TeamsClientConfiguration
2021-05-03T12:21:30.4830766Z ' (id: Global) is not in desired state:
2021-05-03T12:21:30.4840896Z 	 - Parameter: 'RestrictedSenderList' > Actual value: '' | Desired value: ''
2021-05-03T12:21:30.4847608Z 
2021-05-03T12:21:30.4857604Z [Get-DscEvents] Parameters checked: 17.
2021-05-03T12:21:30.4865818Z [Get-DscEvents] Events in Microsoft-Windows-Dsc/Operational -- BEGIN>
2021-05-03T12:21:30.5486439Z Job {6CE81839-AC08-11EB-823A-000D3ADB437E} : Details logging completed for C:\Windows\system32\configuration\ConfigurationStatus\{6CE81839-AC08-11EB-823A-000D3ADB437E}-0.details.json.Job {6CE81839-AC08-11EB-823A-000D3ADB437E} : 
2021-05-03T12:21:30.5497592Z MIResult: 1
2021-05-03T12:21:30.5501908Z Error Message: The current configuration was cancelled. LCM failed to start desired state configuration manually.
2021-05-03T12:21:30.5510200Z Message ID: MI RESULT 1
2021-05-03T12:21:30.5514249Z Error Category: 0
2021-05-03T12:21:30.5521683Z Error Code: 1
2021-05-03T12:21:30.5525210Z Error Type: MIJob {6CE81839-AC08-11EB-823A-000D3ADB437E} : 
2021-05-03T12:21:30.5543726Z Current configuration is cancelled. 124 out of 4 resources are not configured.Job {161E31C8-AC0A-11EB-823A-000D3ADB437E} : 
2021-05-03T12:21:30.5545153Z Operation Stop-DscConfiguration -Force completed successfully.Job {161E31C8-AC0A-11EB-823A-000D3ADB437E} : 
2021-05-03T12:21:30.5546322Z Current configuration is forcely stopped.Job {6CE81839-AC08-11EB-823A-000D3ADB437E} : 
2021-05-03T12:21:30.5551115Z Configuration is stopped when Powershell DSC resource is executing.Job {161E31C8-AC0A-11EB-823A-000D3ADB437E} : 
2021-05-03T12:21:30.5560117Z Operation Stop-DscConfiguration -Force started by user sid S-1-5-21-1346823733-1267673255-1723561725-500 from computer NULL.Job {6CE81839-AC08-11EB-823A-000D3ADB437E} : 
2021-05-03T12:21:30.5564945Z MIResult: 1
2021-05-03T12:21:30.5573639Z Error Message: The PowerShell DSC resource '[TeamsClientConfiguration]a0a3947d-6a39-4049-81c1-22f8e949bbc1' with SourceInfo 'D:\a\r1\a\M365_DSC-CI-DEVELOP\DSC\Configuration\dev\config.dev.teams.ps1::158::9::TeamsClientConfiguration' threw one or more non-terminating errors while running the Set-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
2021-05-03T12:21:30.5579133Z Message ID: NonTerminatingErrorFromProvider
2021-05-03T12:21:30.5588030Z Error Category: 7
2021-05-03T12:21:30.5592629Z Error Code: 1
2021-05-03T12:21:30.5601302Z Error Type: MIJob {6CE81839-AC08-11EB-823A-000D3ADB437E} : 
2021-05-03T12:21:30.5606668Z This event indicates that failure happens when LCM is processing the configuration. Error Id is 0x1. Error Detail is The SendConfigurationApply function did not succeed.. Resource Id is [TeamsClientConfiguration]a0a3947d-6a39-4049-81c1-22f8e949bbc1 and Source Info is D:\a\r1\a\M365_DSC-CI-DEVELOP\DSC\Configuration\dev\config.dev.teams.ps1::158::9::TeamsClientConfiguration. Error Message is The PowerShell DSC resource '[TeamsClientConfiguration]a0a3947d-6a39-4049-81c1-22f8e949bbc1' with SourceInfo 'D:\a\r1\a\M365_DSC-CI-DEVELOP\DSC\Configuration\dev\config.dev.teams.ps1::158::9::TeamsClientConfiguration' threw one or more non-terminating errors while running the Set-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details..Job {6CE81839-AC08-11EB-823A-000D3ADB437E} : 
2021-05-03T12:21:30.5616931Z MIResult: 1
2021-05-03T12:21:30.5621314Z Error Message: Cannot convert '<redacted1>.de <redacted2>.de' to the type 'System.String' required by parameter 'RestrictedSenderList'. Specified method is not supported.
2021-05-03T12:21:30.5633345Z Message ID: CannotConvertArgument,Microsoft.Rtc.Management.Internal.SetTeamsClientConfigurationCmdlet
2021-05-03T12:21:30.5634292Z Error Category: 5
2021-05-03T12:21:30.5638300Z Error Code: 5
2021-05-03T12:21:30.5645594Z Error Type: MIJob {6CE81839-AC08-11EB-823A-000D3ADB437E} : 
2021-05-03T12:21:30.5651282Z This event indicates that a non-terminating error was thrown when DSCEngine was executing Set-TargetResource on MSFT_TeamsClientConfiguration DSC resource. FullyQualifiedErrorId is CannotConvertArgument,Microsoft.Rtc.Management.Internal.SetTeamsClientConfigurationCmdlet. Error Message is Cannot convert '<redacted1>.de <redacted2>.de' to the type 'System.String' required by parameter 'RestrictedSenderList'. Specified method is not supported.

Suggested solution to the issue

We're guessing that there should be some conversion done between the string arrays accepted by the DSC module (which makes sense for proper config drift detection in a list of domains) and the single-string domain list the Set-CsTeamsClientConfiguration ecpects/the Get-CsTeamsClientConfiguration provides, while also being aware that there could be many different kinds of separators between the domains (Get-CsTeamsClientConfiguration in my tests always returned exactly the string I sent to it, including the separators I used originally).

The DSC configuration that is used to reproduce the issue (as detailed as possible)

TeamsClientConfiguration a0a3947d-6a39-4049-81c1-22f8e949bbc1
        {
            AllowBox                         = $False;
            AllowDropBox                     = $False;
            AllowEgnyte                      = $False;
            AllowEmailIntoChannel            = $True;
            AllowGoogleDrive                 = $False;
            AllowGuestUser                   = $True;
            AllowOrganizationTab             = $False;
            AllowResourceAccountSendMessage  = $True;
            AllowScopedPeopleSearchandAccess = $False;
            AllowShareFile                   = $False;
            AllowSkypeBusinessInterop        = $True;
            ContentPin                       = "RequiredOutsideScheduleMeeting";
            GlobalAdminAccount               = $Credsglobaladmin;
            Identity                         = "Global";
            ResourceAccountContentAccess     = "NoAccess";
            RestrictedSenderList             = @("<redacted1>.de", "<redacted2>.de")
        }

The operating system the target node is running

Azure Pipelines agent with latest image config.

Version of the DSC module that was used ('dev' if using current dev branch)

1.21.428.1

EricHindrichsen avatar May 03 '21 15:05 EricHindrichsen

Hi @NikCharlebois, any idea what might be the issue here? This is a blocker for us since the whole DSC run crashes...

EricHindrichsen avatar May 10 '21 14:05 EricHindrichsen

@EricHindrichsen we have submitted a fix https://github.com/microsoft/Microsoft365DSC/pull/1210

NikCharlebois avatar May 14 '21 18:05 NikCharlebois

After updating to the latest DSC release and then updating MSCloudLoginAssistant to version 1.0.53 I was able to verify that this issue is now fixed. Thanks a lot everyone!

EricHindrichsen avatar May 28 '21 13:05 EricHindrichsen