Functions/Get-Office365SecurityAndComplianceSettingObjects.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<#
.SYNOPSIS
    This function returns objects representing the various settings which can be retrieved from Office 365 Security And Compliance.
.DESCRIPTION
    This function returns objects representing the various settings which can be retrieved from Office 365 Security And Compliance.
    Each object contains a description of the setting, a script block which returns the value of the setting, and the name of the setting which is suitable for a variable name.
#>

function Get-Office365SecurityAndComplianceSettingObjects {
    [CmdletBinding(PositionalBinding=$false)]
    [OutputType([PSCustomObject[]])]
    param ()

    # Return the setting objects
    return @(
        [PSCustomObject]@{
            Description = "activity alerts"
            ScriptBlock = {
                Get-ActivityAlert
            }
            VariableName = "ActivityAlerts"
        },
        [PSCustomObject]@{
            Description = "compliance security filters"
            ScriptBlock = {
                Get-ComplianceSecurityFilter
            }
            VariableName = "ComplianceSecurityFilters"
        },
        [PSCustomObject]@{
            Description = "compliance policies"
            ScriptBlock = {
                Get-DLPCompliancePolicy
            }
            VariableName = "CompliancePolicies"
        },
        [PSCustomObject]@{
            Description = "compliance rules"
            ScriptBlock = {
                Get-DLPComplianceRule
            }
            VariableName = "ComplianceRules"
        },
        [PSCustomObject]@{
            Description = "sensitive information types"
            ScriptBlock = {
                Get-DLPSensitiveInformationType
            }
            VariableName = "SensitiveInformationTypes"
        },
        [PSCustomObject]@{
            Description = "sensitive information type rule packages"
            ScriptBlock = {
                Get-DLPSensitiveInformationTypeRulePackage
            }
            VariableName = "SensitiveInformationTypeRulePackages"
        },
        [PSCustomObject]@{
            Description = "case hold rules"
            ScriptBlock = {
                Get-CaseHoldRule
            }
            VariableName = "CaseHoldRules"
        },
        [PSCustomObject]@{
            Description = "eDiscovery case administrators"
            ScriptBlock = {
                Get-EDiscoveryCaseAdmin
            }
            VariableName = "EDiscoveryCaseAdministrators"
        },
        [PSCustomObject]@{
            Description = "compliance tags"
            ScriptBlock = {
                Get-ComplianceTag
            }
            VariableName = "ComplianceTags"
        },
        [PSCustomObject]@{
            Description = "compliance tag storage"
            ScriptBlock = {
                Get-ComplianceTagStorage
            }
            VariableName = "ComplianceTagStorage"
        },
        [PSCustomObject]@{
            Description = "retention compliance policies"
            ScriptBlock = {
                Get-RetentionCompliancePolicy
            }
            VariableName = "RetentionCompliancePolicy"
        },
        [PSCustomObject]@{
            Description = "retention compliance rules"
            ScriptBlock = {
                Get-RetentionComplianceRule
            }
            VariableName = "RetentionComplianceRules"
        },
        [PSCustomObject]@{
            Description = "management roles"
            ScriptBlock = {
                Get-ManagementRole
            }
            VariableName = "ManagementRoles"
        },
        [PSCustomObject]@{
            Description = "role groups"
            ScriptBlock = {
                Get-RoleGroup
            }
            VariableName = "RoleGroups"
        },
        [PSCustomObject]@{
            Description = "role group members"
            ScriptBlock = {
                foreach ($roleGroup in (Get-RoleGroup)) {
                    $roleGroupMembers = Get-RoleGroupMember -Identity $roleGroup.Name
                    foreach ($member in $roleGroupMembers) {
                        $member | Add-Member -NotePropertyName "RoleGroup" -NotePropertyValue $roleGroup.Name -Force
                        $member
                    }
                }
            }
            VariableName = "RoleGroupMembers"
        },
        [PSCustomObject]@{
            Description = "supervisory review policies"
            ScriptBlock = {
                Get-SupervisoryReviewPolicyV2
            }
            VariableName = "SupervisoryReviewPolicies"
        },
        [PSCustomObject]@{
            Description = "supervisory review rules"
            ScriptBlock = {
                Get-SupervisoryReviewRule
            }
            VariableName = "SupervisoryReviewRules"
        }
    )
}