Skip to content

Export-M365DSCConfiguration: Cannot export resource *TeamsApplicationInstance* #6630

@ricmestre

Description

@ricmestre

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.ForEachObjectCommand

Microsoft 365 DSC Version

1.25.1015.1

Which workloads are affected

Teams

The DSC configuration

N/A

Verbose 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.ForEachObjectCommand

Environment Information + PowerShell Version

Win11/PS5.1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions