Skip to content

O365SearchAndIntelligenceConfigurations: False Drift Detection #6788

@SNikalaichyk

Description

@SNikalaichyk

Description of the issue

The O365SearchAndIntelligenceConfigurations resource incorrectly logs configuration drift when encountering errors during Test, despite properly returning an error and not executing Set.

Root Cause

The O365SearchAndIntelligenceConfigurations resource correctly handles failures by returning errors and not executing the Set method, but it still inappropriately logs configuration drift events when the actual state cannot be determined due to errors.

Expected Behavior

General Principle: Any errors must throw a non-terminating error, must not log drift, and must not execute Set.

When the resource encounters an error and cannot determine the actual state, it should:

  1. ✅ Return an error
  2. ✅ Not execute Set method
  3. ❌ Not log a configuration drift event

Microsoft 365 DSC Version

v1.25.910.2 (and later)

Which workloads are affected

Office 365 Admin

The DSC configuration

Verbose logs showing the problem

Resource error:

Error retrieving data:
{ You cannot call a method on a null-valued expression. }
 \ at Get-TargetResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.25.910.2\DscResources\MSFT_O365SearchAndIntelligenceConfigurations\MSFT_O365SearchAndIntelligenceConfigurations.psm1: line 120
 \ at Test-M365DSCTargetResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.25.910.2\Modules\M365DSCUtil.psm1: line 1133
 \ at Test-TargetResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.25.910.2\DscResources\MSFT_O365SearchAndIntelligenceConfigurations\MSFT_O365SearchAndIntelligenceConfigurations.psm1: line 359

TenantId: contoso.onmicrosoft.com

Job error:

MIResult: 1
Error Message: The PowerShell DSC resource '[O365SearchAndIntelligenceConfigurations]O365SearchAndIntelligenceConfigurations' with SourceInfo 'REDACTED' threw one or more non-terminating errors while running the Test-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
Message ID: NonTerminatingErrorFromProvider
Error Category: 7
Error Code: 1
Error Type: MI

False drift event:

<M365DSCEvent>
    <ConfigurationDrift Source="MSFT_O365SearchAndIntelligenceConfigurations" TenantId="contoso.onmicrosoft.com" LCMState="ConsistencyCheck">
        <ParametersNotInDesiredState>
            <Param Name="ItemInsightsIsEnabledInOrganization"><CurrentValue></CurrentValue><DesiredValue>True</DesiredValue></Param>
            <Param Name="PersonInsightsIsEnabledInOrganization"><CurrentValue></CurrentValue><DesiredValue>True</DesiredValue></Param>
            <Param Name="MeetingInsightsIsEnabledInOrganization"><CurrentValue></CurrentValue><DesiredValue>True</DesiredValue></Param>
        </ParametersNotInDesiredState>
    </ConfigurationDrift>
    <DesiredValues>
        <Param Name ="IsSingleInstance">Yes</Param>
        <Param Name ="ItemInsightsIsEnabledInOrganization">True</Param>
        <Param Name ="MeetingInsightsIsEnabledInOrganization">True</Param>
        <Param Name ="PersonInsightsIsEnabledInOrganization">True</Param>
        <!-- REDACTED -->
    </DesiredValues>
    <CurrentValues>
        <Param Name ="IsSingleInstance">Yes</Param>
    </CurrentValues>
</M365DSCEvent>

Environment Information + PowerShell Version

Metadata

Metadata

Assignees

No one assigned

    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