Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCComplianceRetentionRule: Related policy changes in same MOF prevent rule changes #2728

Closed
T630Dev opened this issue Jan 2, 2023 · 0 comments · Fixed by #2744 or #2745
Closed

SCComplianceRetentionRule: Related policy changes in same MOF prevent rule changes #2728

T630Dev opened this issue Jan 2, 2023 · 0 comments · Fixed by #2744 or #2745

Comments

@T630Dev
Copy link

T630Dev commented Jan 2, 2023

ISSUE DESCRIPTION (this template):
The retention rule is related to a corresponding retention policy. (via the Policy attribute in the rule)
When the rentention policy test method returns true, the related rule change in the same MOF works fine.
However, when I do a policy change (for example change the comment String) and afterwards I want to change the rule (i.e ExpirationDateOption), I receive an error message saying that the related policy is still being deployed and cannot be changed.
If I then wait and start the same DSC configuration again (Start-DSCConfiguration), the policy ressource returns true and then also the rule works. This is for our use case not ok as the DSC run needs to succeed on the first run.

Details of the scenario you tried and the problem that is occurring

Verbose logs showing the problem

PreReq: The related policy to the rule must be changed in the same run. Test method returns false (as expected)
image

The rule test method returns false (as expected) but then throws the error:
image

Suggested solution to the issue

na since in constrast to the policy, the underlying ps cmdlet for the rule has no force parameter.
Maybe the set method of the rule needs to check the state of the policy and then delay the change to the rule?
Also worth reporting this to the product group why we cannot change the rule and it needs to wait for the policy while in the policy itself, they implemented the force option.

The DSC configuration that is used to reproduce the issue (as detailed as possible)

Configuration MainConfig
{
    param
    (
         [Parameter(Mandatory = $true,Position=0)][ValidateNotNull()][System.Management.Automation.PSCredential]$AdminCred
    )
    Import-DscResource -ModuleName "Microsoft365DSC"
    Node localhost
    {
                
        SCRetentionCompliancePolicy 'RetentionCompliancePolicyEXO-106'
        {
                Name = "Exchange Online Standard Retention Policy for DemoTenant";
                Comment = "Standard Aufbewahrungsfrist für Exchange Online 93 Tage inkl. M365Groups DEMO";
                RestrictiveRetention = $False;
                ModernGroupLocation = "All"; 
                ExchangeLocation = "All";
                Ensure = "Present";
                Enabled = $False;
                Credential = $AdminCred;
        }

        SCRetentionComplianceRule 'RetentionComplianceRuleEXO-109'
        {
                Name = "Exchange Online Standard Retention Rule for DemoTenant";
                Policy = "Exchange Online Standard Retention Policy for DemoTenant";
                ExpirationDateOption = "ModificationAgeInDays";
                RetentionDurationDisplayHint = "Days";
                RetentionComplianceAction = "Keep";
                Ensure = "Present";
                RetentionDuration = "93";
                Credential = $AdminCred;
        }

    }
}

The operating system the target node is running

The operating system the target node is running
OsName : Microsoft Windows Server 2019 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture : 64-Bit
WindowsVersion : 1809
WindowsBuildLabEx : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage : en-US
OsMuiLanguages : {en-US, de-DE}

Version of the DSC module that was used ('dev' if using current dev branch)

1.22.1221.1

NikCharlebois added a commit to NikCharlebois/Microsoft365DSC that referenced this issue Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant