Skip to content

Commit 58d8408

Browse files
authored
Merge pull request #183 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents 8c0e0c7 + b13e376 commit 58d8408

11 files changed

+35
-24
lines changed

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardIntuneComplianceSettings.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function Invoke-CIPPStandardIntuneComplianceSettings {
3131

3232
param($Tenant, $Settings)
3333

34-
$CurrentState = New-GraphGetRequest -Uri 'https://graph.microsoft.com/beta/deviceManagement/settings' -tenantid $Tenant
34+
$CurrentState = New-GraphGetRequest -Uri 'https://graph.microsoft.com/beta/deviceManagement/settings' -tenantid $Tenant | Select-Object secureByDefault, deviceComplianceCheckinThresholdDays
3535

3636
if ($null -eq $Settings.deviceComplianceCheckinThresholdDays) { $Settings.deviceComplianceCheckinThresholdDays = $CurrentState.deviceComplianceCheckinThresholdDays }
3737
$SecureByDefault = [bool]($Settings.secureByDefault.value ? $Settings.secureByDefault.value : $Settings.secureByDefault)

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardSPEmailAttestation.ps1

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,26 @@ function Invoke-CIPPStandardSPEmailAttestation {
3535

3636
$CurrentState = Get-CIPPSPOTenant -TenantFilter $Tenant | Select-Object -Property EmailAttestationReAuthDays, EmailAttestationRequired
3737

38-
$StateIsCorrect = ($CurrentState.EmailAttestationReAuthDays -eq $Settings.Days) -and
38+
$StateIsCorrect = ($CurrentState.EmailAttestationReAuthDays -eq [int]$Settings.Days) -and
3939
($CurrentState.EmailAttestationRequired -eq $true)
4040

4141
if ($Settings.remediate -eq $true) {
4242
if ($StateIsCorrect -eq $true) {
4343
Write-LogMessage -API 'Standards' -Tenant $Tenant -Message 'SharePoint reauthentication with verification code is already restricted.' -Sev Info
4444
} else {
4545
$Properties = @{
46-
EmailAttestationReAuthDays = $Settings.Days
46+
EmailAttestationReAuthDays = [int]$Settings.Days
4747
EmailAttestationRequired = $true
4848
}
4949

5050
try {
51-
Get-CIPPSPOTenant -TenantFilter $Tenant | Set-CIPPSPOTenant -Properties $Properties
52-
Write-LogMessage -API 'Standards' -Tenant $Tenant -Message 'Successfully set reauthentication with verification code restriction.' -Sev Info
51+
$Response = Get-CIPPSPOTenant -TenantFilter $Tenant | Set-CIPPSPOTenant -Properties $Properties
52+
if ($Response.ErrorInfo.ErrorMessage) {
53+
$ErrorMessage = Get-NormalizedError -Message $Response.ErrorInfo.ErrorMessage
54+
Write-LogMessage -API 'Standards' -Tenant $Tenant -Message "Failed to set reauthentication with verification code restriction. Error: $ErrorMessage" -Sev Error
55+
} else {
56+
Write-LogMessage -API 'Standards' -Tenant $Tenant -Message 'Successfully set reauthentication with verification code restriction.' -Sev Info
57+
}
5358
} catch {
5459
$ErrorMessage = Get-NormalizedError -Message $_.Exception.Message
5560
Write-LogMessage -API 'Standards' -Tenant $Tenant -Message "Failed to set reauthentication with verification code restriction. Error: $ErrorMessage" -Sev Error

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardSpamFilterPolicy.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function Invoke-CIPPStandardSpamFilterPolicy {
7373
($CurrentState.PhishQuarantineTag -eq $PhishQuarantineTag) -and
7474
($CurrentState.HighConfidencePhishAction -eq 'Quarantine') -and
7575
($CurrentState.HighConfidencePhishQuarantineTag -eq $HighConfidencePhishQuarantineTag) -and
76-
($CurrentState.BulkThreshold -eq $Settings.BulkThreshold) -and
76+
($CurrentState.BulkThreshold -eq [int]$Settings.BulkThreshold) -and
7777
($CurrentState.QuarantineRetentionPeriod -eq 30) -and
7878
($CurrentState.IncreaseScoreWithImageLinks -eq $IncreaseScoreWithImageLinks) -and
7979
($CurrentState.IncreaseScoreWithNumericIps -eq 'On') -and
@@ -126,7 +126,7 @@ function Invoke-CIPPStandardSpamFilterPolicy {
126126
PhishQuarantineTag = $PhishQuarantineTag
127127
HighConfidencePhishAction = 'Quarantine'
128128
HighConfidencePhishQuarantineTag = $HighConfidencePhishQuarantineTag
129-
BulkThreshold = $Settings.BulkThreshold
129+
BulkThreshold = [int]$Settings.BulkThreshold
130130
QuarantineRetentionPeriod = 30
131131
IncreaseScoreWithImageLinks = $IncreaseScoreWithImageLinks
132132
IncreaseScoreWithNumericIps = 'On'

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardTeamsEmailIntegration.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Function Invoke-CIPPStandardTeamsEmailIntegration {
6666
}
6767
}
6868

69-
if ($Setings.report -eq $true) {
69+
if ($Settings.report -eq $true) {
7070

7171
if ($StateIsCorrect) {
7272
$FieldValue = $true

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardTeamsExternalAccessPolicy.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function Invoke-CIPPStandardTeamsExternalAccessPolicy {
7373
}
7474
}
7575

76-
if ($Setings.report -eq $true) {
76+
if ($Settings.report -eq $true) {
7777
Add-CIPPBPAField -FieldName 'TeamsExternalAccessPolicy' -FieldValue $StateIsCorrect -StoreAs bool -Tenant $Tenant
7878

7979
if ($StateIsCorrect) {

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardTeamsExternalFileSharing.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function Invoke-CIPPStandardTeamsExternalFileSharing {
8181
}
8282
}
8383

84-
if ($Setings.report -eq $true) {
84+
if ($Settings.report -eq $true) {
8585
Add-CIPPBPAField -FieldName 'TeamsExternalFileSharing' -FieldValue $StateIsCorrect -StoreAs bool -Tenant $Tenant
8686

8787
if ($StateIsCorrect) {

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardTeamsFederationConfiguration.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ function Invoke-CIPPStandardTeamsFederationConfiguration {
129129
}
130130
}
131131

132-
if ($Setings.report -eq $true) {
132+
if ($Settings.report -eq $true) {
133133
Add-CIPPBPAField -FieldName 'FederationConfiguration' -FieldValue $StateIsCorrect -StoreAs bool -Tenant $Tenant
134-
if ($StateIsCorrect) {
134+
if ($StateIsCorrect -eq $true) {
135135
$FieldValue = $true
136136
} else {
137137
$FieldValue = $CurrentState

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardUserPreferredLanguage.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function Invoke-CIPPStandardUserPreferredLanguage {
6262
Write-StandardsAlert -message "The following accounts do not have the preferred language set to $preferredLanguage" -object $IncorrectUsers -tenant $Tenant -standardName 'UserPreferredLanguage' -standardId $Settings.standardId
6363
Write-LogMessage -API 'Standards' -tenant $Tenant -message "The following accounts do not have the preferred language set to $preferredLanguage : $($IncorrectUsers.userPrincipalName -join ', ')" -sev Info
6464
} else {
65-
Write-LogMessage -API 'Standards' -tenant $Tenant -message 'No accounts do not have the preferred language set to the preferred language' -sev Info
65+
Write-LogMessage -API 'Standards' -tenant $Tenant -message 'All accounts have the preferred language set.' -sev Info
6666
}
6767
}
6868

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardsharingDomainRestriction.ps1

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,15 @@ function Invoke-CIPPStandardsharingDomainRestriction {
4141
$StateIsCorrect = $CurrentState.sharingDomainRestrictionMode -eq 'none'
4242
} else {
4343
$SelectedDomains = [String[]]$Settings.Domains.Split(',').Trim() ?? @()
44-
$StateIsCorrect = ($CurrentState.sharingDomainRestrictionMode -eq $mode) -and
45-
($mode -eq 'allowList' -and (!(Compare-Object -ReferenceObject $CurrentState.sharingAllowedDomainList -DifferenceObject $SelectedDomains))) -or
46-
($mode -eq 'blockList' -and (!(Compare-Object -ReferenceObject $CurrentState.sharingBlockedDomainList -DifferenceObject $SelectedDomains)))
44+
$CurrentAllowedDomains = $CurrentState.sharingAllowedDomainList ?? @()
45+
$CurrentBlockedDomains = $CurrentState.sharingBlockedDomainList ?? @()
46+
47+
$StateIsCorrect = ($CurrentState.sharingDomainRestrictionMode -eq $mode) -and (
48+
($mode -eq 'allowList' -and ([string[]]($CurrentAllowedDomains | Sort-Object) -join ',') -eq ([string[]]($SelectedDomains | Sort-Object) -join ',')) -or
49+
($mode -eq 'blockList' -and ([string[]]($CurrentBlockedDomains | Sort-Object) -join ',') -eq ([string[]]($SelectedDomains | Sort-Object) -join ','))
50+
)
4751
}
52+
Write-Host "StateIsCorrect: $StateIsCorrect"
4853

4954
if ($Settings.remediate -eq $true) {
5055
if ($StateIsCorrect -eq $true) {
@@ -61,14 +66,15 @@ function Invoke-CIPPStandardsharingDomainRestriction {
6166
}
6267

6368
$cmdParams = @{
64-
tenantid = $tenant
65-
uri = 'https://graph.microsoft.com/beta/admin/sharepoint/settings'
66-
AsApp = $true
67-
Type = 'PATCH'
68-
Body = ($Body | ConvertTo-Json)
69-
ContentType = 'application/json'
69+
tenantid = $tenant
70+
uri = 'https://graph.microsoft.com/beta/admin/sharepoint/settings'
71+
AsApp = $true
72+
Type = 'PATCH'
73+
body = ($Body | ConvertTo-Json)
7074
}
7175

76+
Write-Host ($cmdParams | ConvertTo-Json -Depth 5)
77+
7278
try {
7379
$null = New-GraphPostRequest @cmdParams
7480
Write-LogMessage -API 'Standards' -tenant $tenant -message 'Successfully updated Sharing Domain Restriction settings' -sev Info

Modules/CIPPCore/Public/Webhooks/Test-CIPPAuditLogRules.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ function Test-CIPPAuditLogRules {
195195
$CIPPClause = [System.Collections.Generic.List[string]]::new()
196196
$AddedLocationCondition = $false
197197
foreach ($condition in $conditions) {
198-
if ($condition.Property.value -eq 'CIPPGeoLocation' -and !$AddedLocationCondition) {
198+
if ($condition.Property.label -eq 'CIPPGeoLocation' -and !$AddedLocationCondition) {
199199
$conditionsString.Add("`$_.HasLocationData -eq `$true")
200200
$CIPPClause.Add('HasLocationData is true')
201201
$AddedLocationCondition = $true

0 commit comments

Comments
 (0)