- 
                Notifications
    
You must be signed in to change notification settings  - Fork 606
 
Description
Description of the issue
I have a foreach loop iterating each workload to export it independently, after several hours to make it work with the latest M365DSC version I finally found my issue and fixed it, problem is that it's exporting all my workloads except Teams.
Just to ensure it's not something that it's being caused by my code I'm calling export with these parameters below, locally, and it still fails always with the same error message, shown at the bottom. With debug messages I can see that both $exportScriptBlock and $resourcesPath are declared and are correctly defined, but it still fails saying You cannot call a method on a null-valued expression, not sure what's going on here.
EDIT: The issue seems to affect only resource TeamsApplicationInstance
Name                           Value 
----                           -----
Path                           C:\Users\dummy\AppData\Local\Temp
FileName                       M365Configuration-Teams.ps1
CertificateThumbprint          dummy
ApplicationId                  dummy
ConfigurationName              ConfigureMicrosoft365
TenantId                       dummy.onmicrosoft.com
Components                     {TeamsApplicationInstance, TeamsAppPermissionPolicy, TeamsAppSetupPolicy, TeamsAudioConferencingPoli...
ExcludeComponents              {AADApplication, AADAuthenticationRequirement, AADGroup, AADPIMGroupSetting...}ForEach-Object : You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\microsoft365dsc\1.25.1015.1\Modules\M365DSCReverse.psm1:791 char:30
+ ...           $resourcesPath | ForEach-Object -Process $exportScriptBlock
+                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [ForEach-Object], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull,Microsoft.PowerShell.Commands.ForEachObjectCommandMicrosoft 365 DSC Version
1.25.1015.1
Which workloads are affected
Teams
The DSC configuration
N/AVerbose logs showing the problem
ForEach-Object : You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\microsoft365dsc\1.25.1015.1\Modules\M365DSCReverse.psm1:791 char:30
+ ...           $resourcesPath | ForEach-Object -Process $exportScriptBlock
+                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [ForEach-Object], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull,Microsoft.PowerShell.Commands.ForEachObjectCommandEnvironment Information + PowerShell Version
Win11/PS5.1