New-M365DSCDeltaReport returns no delta information
Details of the scenario you tried and the problem that is occurring
Comparing the files output by Export-M365DSCConfiguration for two different SPO tenant level settings (CommentsOnSitePagesDisabled, SPOHubSite, LegacyAuthProtocolsEnabled, etc), the New-M365DSCDeltaReport command does not output any difference information.
New-M365DSCDeltaReport -Source "C:\temp\dsc\20220526Config.ps1" -Destination "C:\temp\dsc\InitialConfig.ps1" -OutputPath "C:\temp\dsc\output.html"

Verbose logs showing the problem
Suggested solution to the issue
The DSC configuration that is used to reproduce the issue (as detailed as possible)
# insert configuration here
The operating system the target node is running
Version of the DSC module that was used ('dev' if using current dev branch)
1.22.525.1

I am also getting similar issues. Blueprint assessments - been struggling for a few versions now. Have found some issues get fixed by closing the powershell window and re-opening, but as yet a Assert or delta reports do not work.
These are the errors im getting
Test-Path : Cannot bind argument to parameter 'Path' because it is an empty string.
At C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.22.525.1\modules\M365DSCReport.psm1:833 char:26
+ if ((Test-Path -Path $OutputPath) -eq $false)
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Test-Path], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.Test
PathCommand
Exception calling "IndexOf" with "2" argument(s): "Index was out of range. Must be non-negative and less than the size
of the collection.
Parameter name: startIndex"
At C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.22.525.1\modules\M365DSCReport.psm1:475 char:9
+ $endPosition = $fileContent.IndexOf("`r", $startPosition)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentOutOfRangeException
Exception calling "Remove" with "2" argument(s): "StartIndex cannot be less than zero.
Parameter name: startIndex"
At C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.22.525.1\modules\M365DSCReport.psm1:476 char:9
+ $fileContent = $fileContent.Remove($startPosition, $endPositi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentOutOfRangeException
<h1>Blueprint Assessment Report</h1>
<html><head><meta charset='utf-8'><title>Microsoft365DSC - Blueprint Assessment Report</title></head><body>
<div style='width:100%;text-align:center;'>
<img src='http://Microsoft365DSC.com/Images/Promo.png' alt='Microsoft365DSC Slogan' width='500' />
</div>
<p><strong>No discrepancies have been found!</strong></p>
</body></html>
I want to compare a dev environment after making changes, and also against a blueprint thats created. If for some reason i have multiple compliance policies etc, it should match and compare all of them against the template surely?
Exception calling "IndexOf" with "2" argument(s): "Index was out of range. Must be non-negative and less than the size
of the collection.
Parameter name: startIndex"
At C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.22.525.1\modules\M365DSCReport.psm1:475 char:9
+ $endPosition = $fileContent.IndexOf("`r", $startPosition)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentOutOfRangeException
Exception calling "Remove" with "2" argument(s): "StartIndex cannot be less than zero.
Parameter name: startIndex"
At C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.22.525.1\modules\M365DSCReport.psm1:476 char:9
+ $fileContent = $fileContent.Remove($startPosition, $endPositi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentOutOfRangeException
These errors are related to configurations that do not hold proper information about the Microsoft365DSC Version used for the export/configuration.
Please make sure to have the following line with -ModuleVersion within your configuration/blueprint
Import-DscResource -ModuleName 'Microsoft365DSC' -ModuleVersion '1.22.202.1'
$OutputPath is a mandatory parameter. Currently the parameter misses this appropriate annotation.
Hi Andi,
I don't fully agree with your statement of the 'ModuleVersion' being required, because in all the functions in M365DSC that use ConvertTo-DSCObject these are stripped from the file content before parsing the DSC file (effectively breaking ConvertTo-DSCObject in PS7)
To illustrate what I mean, please see these lines https://github.com/microsoft/Microsoft365DSC/blob/c0aca5f5518464ba1b2a2508999c54fe593a6cda/Modules/Microsoft365DSC/Modules/M365DSCReport.psm1#L39 https://github.com/microsoft/Microsoft365DSC/blob/c0aca5f5518464ba1b2a2508999c54fe593a6cda/Modules/Microsoft365DSC/Modules/M365DSCReport.psm1#L179 https://github.com/microsoft/Microsoft365DSC/blob/c0aca5f5518464ba1b2a2508999c54fe593a6cda/Modules/Microsoft365DSC/Modules/M365DSCReport.psm1#L279 https://github.com/microsoft/Microsoft365DSC/blob/c0aca5f5518464ba1b2a2508999c54fe593a6cda/Modules/Microsoft365DSC/Modules/M365DSCReport.psm1#L476 https://github.com/microsoft/Microsoft365DSC/blob/c0aca5f5518464ba1b2a2508999c54fe593a6cda/Modules/Microsoft365DSC/Modules/M365DSCReport.psm1#L484 https://github.com/microsoft/Microsoft365DSC/blob/147cf9d5e0073d2009235c2f2e2256ffd3047a05/Modules/Microsoft365DSC/Modules/M365DSCUtil.psm1#L2298
This modification of the DSC content breaks parsing the DSC object in PowerShell 7. To summarize, here are the results of my tests:
ConvertTo-DSCObject, file content WITH ModuleVersion PS5: works PS7: works
ConvertTo-DSCObject, file content WITHOUT ModuleVersion PS5: works PS7: does not work, results in empty DSCobject
So, in general I think it's better to NOT strip the ModuleVersion from the FileContent so it will work in all PS versions...
@NikCharlebois I see you've added these modifications in https://github.com/microsoft/Microsoft365DSC/commit/87bf79fe230419fdee72de410916612328f1aecc any idea on why this was added?
That change was made to allow the conversion of configurations regardless of microsoft365dsc module version available on the system.
could you verify that you do not have multiple versions of m365dsc installed within ps7? Please have a look at the comments within #2120.
Andi is correct, the ModuleVersion was removed to ensure you could compare two configurations that were using a different version of the module. Otherwise, you would have to manually update the configuration to point to the correct installed version every time an assessment was being performed. I am working on a fix that will ensure the ModuleVersion is found before attempting to strip it out. I was able to confirm that this works with both PoSh 5 and 7.1 if the module version is not specified in the files.
Oops, my bad. Removing the old Microsoft365DSC versions in PS7 fixed it for me. I assumed this had to do with the difference in PowerShell versions, but just now I learned that only one version of the Microsoft365DSC module needs to be installed... Thanks for having a look @andikrueger and @NikCharlebois!