Microsoft365DSC icon indicating copy to clipboard operation
Microsoft365DSC copied to clipboard

[ERROR] M365DSCReport.psm1 - New-M365DSCReportFromConfiguration function - Parsed content was null

Open Kierow opened this issue 2 years ago • 2 comments

Description of the issue

Hello,

It seems that during 1.24.214.2 release, the following code was introduced in the M365DSCReport.psm1 module and more particularly in New-M365DSCReportFromConfiguration function: if ($null -ne $parsedContent) { Code... } else { throw "Parsed content was null." }

When I export several components, I don't face any error. image

However, if I export only one component that is empty, I will have this error: image

This error comes from the code stated above. Before this release, the $parsedContent was not checked and it was possible to make a report of a component that is empty.

For more information, here is the content of AADAuthenticationContextClassReference.ps1 (used for the report where $parsedContent is null):


`` Generated with Microsoft365DSC version 1.24.313.1 For additional information on how to use Microsoft365DSC, please visit https://aka.ms/M365DSC param ( )

Configuration DEV-M365Tenant-AAD-AADAuthenticationContextClassReference { param ( )

$OrganizationName = $ConfigurationData.NonNodeData.OrganizationName

Import-DscResource -ModuleName 'Microsoft365DSC' -ModuleVersion '1.24.313.1'

Node localhost
{

    For information on how to use this resource, please refer to:
    https://github.com/microsoft/Microsoft365DSC/wiki/AADAuthenticationContextClassReference
}

}

DEV-M365Tenant-AAD-AADAuthenticationContextClassReference -ConfigurationData .\ConfigurationData.psd1

``

I don't know if it's something expected... therefore I submit this issue. :)

If you need more information, don't hesitate.

Microsoft 365 DSC Version

1.24.313.1

Which workloads are affected

other

The DSC configuration

No response

Verbose logs showing the problem

No response

Environment Information + PowerShell Version

No response

Kierow avatar Mar 28 '24 16:03 Kierow

This is partially expected as there is no data within your configuration and therefore nothing to report... I guess it would still add value if we would not terminate the process like this and still generate a report stating: nothing to report.

andikrueger avatar Mar 31 '24 05:03 andikrueger

Thanks for your answer ! Yes, the main issue currently is that it stops the process, and in my opinion it would be better if it generates a report stating "nothing to report" as you said (or even nothing at all), but it should not stop the process (it should just go to the next instruction).

Kierow avatar Mar 31 '24 16:03 Kierow