Checks/check-IG101.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using module "..\MCCA.psm1"

class IG101 : MCCACheck {
    <#
     
 
    #>


    IG101() {
        $this.Control = "IG-101"
        $this.ParentArea = "Microsoft Information Governance"
        $this.Area = "Information Governance"
        $this.Name = "Auto-Apply Retention Labels"
        $this.PassText = "Your organization is using auto-apply retention policies"
        $this.FailRecommendation = "Your organization should use auto-apply retention policies"
        $this.Importance = "Your organization should automatically apply retention labels to content when it matches specific conditions (such as containing specific keywords or types of sensitive information). Microsoft recommends that automatic labeling be implemented to decrease reliance on users for correct classification."
        $this.ExpandResults = $True
        $this.CheckType = [CheckType]::ObjectPropertyValue
        $this.ObjectType = "Retention Policies"
        $this.ItemName = "Labels"
        $this.DataType = "Remarks"
        $this.Links = @{
            "Learn More Overview of retention labels"     = "https://docs.microsoft.com/en-us/microsoft-365/compliance/labels?redirectSourcePath=%252farticle%252faf398293-c69d-465e-a249-d74561552d30&view=o365-worldwide"
            "Overview of retention policies"              = "https://docs.microsoft.com/en-us/microsoft-365/compliance/retention-policies?view=o365-worldwide"
            "Compliance Center - Information Governance" = "https://compliance.microsoft.com/informationgovernance?"
            "Compliance Manager - IG Actions" = "https://compliance.microsoft.com/compliancescore?filter=%7B%22Solution%22:%5B%22Information%20governance%22%5D,%22Status%22:%5B%22None%22,%22NotAssessed%22,%22Passed%22,%22FailedLowRisk%22,%22FailedMediumRisk%22,%22FailedHighRisk%22,%22ToBeDetermined%22,%22CouldNotBeDetermined%22,%22PartiallyTested%22,%22Select%22%5D%7D&viewid=ImprovementActions"
        }
    
    }

    <#
     
        RESULTS CC Admin, CC Analyst, CC Investigator and CC Viewer
    #>


    GetResults($Config) {               
        if (($Config["GetRetentionComplianceRule"] -eq "Error") -or ($Config["GetRetentionCompliancePolicy"] -eq "Error")) {
            $this.Completed = $false
        }
        else {
            $UtilityFiles = Get-ChildItem "$PSScriptRoot\..\Utilities"

            ForEach ($UtilityFile in $UtilityFiles) {
        
                . $UtilityFile.FullName
                
            }
            
            $LogFile = $this.LogFile
            $Mode = "Auto"
            $ConfigObjectList = Get-RetentionPolicyValidation -LogFile $LogFile -Mode $Mode

            Foreach ($ConfigObject in $ConfigObjectList) {
                $this.AddConfig($ConfigObject)
            }

            
        
            $hasRemediation = $this.Config | Where-Object { $_.RemediationAction -ne ''}
            if ($($hasremediation.count) -gt 0)
            {
                $this.MCCARemediationInfo = New-Object -TypeName MCCARemediationInfo -Property @{
                    RemediationAvailable = $True
                    RemediationText      = "You need to connect to Security & Compliance Center PowerShell to execute the below commands. Please follow steps defined in <a href = 'https://docs.microsoft.com/en-us/powershell/exchange/connect-to-scc-powershell?view=exchange-ps'> Connect to Security & Compliance Center PowerShell</a>."
                }
            }
            $this.Completed = $True
        
        }
        
    }

}