Skip to content

Commit 7e0cf43

Browse files
authored
Merge pull request KelvinTegelaar#1540 from KelvinTegelaar/dev
Dev to hotfix
2 parents 578f421 + 17c489e commit 7e0cf43

25 files changed

+197
-119
lines changed

CIPP-Permissions.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,11 @@
225225
"Name": "Organization.ReadWrite.All",
226226
"Description": "Allows the app to read and write the organization and related resources, on your behalf. Related resources include things like subscribed skus and tenant branding information."
227227
},
228+
{
229+
"Id": "346c19ff-3fb2-4e81-87a0-bac9e33990c1",
230+
"Name": "OrgSettings-Forms.ReadWrite.All",
231+
"Description": "Allows the app to read and write organization-wide Microsoft Forms settings on your behalf."
232+
},
228233
{
229234
"Id": "e67e6727-c080-415e-b521-e3f35d5248e9",
230235
"Name": "PeopleSettings.ReadWrite.All",
@@ -577,6 +582,11 @@
577582
"Name": "Organization.ReadWrite.All",
578583
"Description": "Allows the app to read and write the organization and related resources, without a signed-in user. Related resources include things like subscribed skus and tenant branding information."
579584
},
585+
{
586+
"Id": "2cb92fee-97a3-4034-8702-24a6f5d0d1e9",
587+
"Name": "OrgSettings-Forms.ReadWrite.All",
588+
"Description": "Allows the app to read and write organization-wide Microsoft Forms settings, without a signed-in user."
589+
},
580590
{
581591
"Id": "b6890674-9dd5-4e42-bb15-5af07f541ae1",
582592
"Name": "PeopleSettings.ReadWrite.All",
@@ -637,6 +647,11 @@
637647
"Name": "ReportSettings.ReadWrite.All",
638648
"Description": "Allows the app to read and update all admin report settings, such as whether to display concealed information in reports, without a signed-in user."
639649
},
650+
{
651+
"Id": "025d3225-3f02-4882-b4c0-cd5b541a4e80",
652+
"Name": "RoleManagement.ReadWrite.Exchange",
653+
"Description": "Allows the app to read and manage the role-based access control (RBAC) settings for your organization's Exchange Online service, without a signed-in user. This includes reading, creating, updating, and deleting Exchange management role definitions, role groups, role group membership, role assignments, management scopes, and role assignment policies."
654+
},
640655
{
641656
"Id": "04c55753-2244-4c25-87fc-704ab82a4f69",
642657
"Name": "SecurityAnalyzedMessage.ReadWrite.All",

Modules/CIPPCore/Public/Alerts/Get-CIPPAlertHuntressRogueApps.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function Get-CIPPAlertHuntressRogueApps {
1313
Param (
1414
[Parameter(Mandatory = $false)]
1515
[Alias('input')]
16-
[bool]$InputValue = $false,
16+
$InputValue,
1717
$TenantFilter
1818
)
1919

@@ -22,7 +22,7 @@ function Get-CIPPAlertHuntressRogueApps {
2222
$RogueAppFilter = $RogueApps.appId -join "','"
2323
$ServicePrincipals = New-GraphGetRequest -uri "https://graph.microsoft.com/beta/servicePrincipals?`$filter=appId in ('$RogueAppFilter')" -tenantid $TenantFilter
2424
# If IgnoreDisabledApps is true, filter out disabled service principals
25-
if ($InputValue) {
25+
if ($InputValue -eq $true) {
2626
$ServicePrincipals = $ServicePrincipals | Where-Object { $_.accountEnabled -eq $true }
2727
}
2828

Modules/CIPPCore/Public/AuditLogs/New-CippAuditLogSearch.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ function New-CippAuditLogSearch {
147147
if ($IPAddressFilters) {
148148
$SearchParams.ipAddressFilters = @($IPAddressFilters)
149149
}
150-
if ($ObjectIdFilterss) {
150+
if ($ObjectIdFilters) {
151151
$SearchParams.objectIdFilters = @($ObjectIdFilters)
152152
}
153153
if ($AdministrativeUnitFilters) {

Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Domain Analyser/Push-DomainAnalyserDomain.ps1

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function Push-DomainAnalyserDomain {
8383
# Setup Score Explanation
8484
$ScoreExplanation = [System.Collections.Generic.List[string]]::new()
8585

86-
# Check MX Record
86+
#Region MX Check
8787
$MXRecord = Read-MXRecord -Domain $Domain -ErrorAction Stop
8888

8989
$Result.ExpectedSPFRecord = $MXRecord.ExpectedInclude
@@ -106,8 +106,9 @@ function Push-DomainAnalyserDomain {
106106
} else {
107107
$Result.MailProvider = $MXRecord.MailProvider.Name
108108
}
109+
#EndRegion MX Check
109110

110-
# Get SPF Record
111+
#Region SPF Check
111112
try {
112113
$SPFRecord = Read-SpfRecord -Domain $Domain -ErrorAction Stop
113114
if ($SPFRecord.RecordCount -gt 0) {
@@ -126,21 +127,21 @@ function Push-DomainAnalyserDomain {
126127
Write-LogMessage -API 'DomainAnalyser' -tenant $DomainObject.TenantId -message $Message -LogData (Get-CippException -Exception $_) -sev Error
127128
}
128129

129-
# Check SPF Record
130-
$Result.SPFPassAll = $false
131130

132131
# Check warning + fail counts to ensure all tests pass
133132
#$SPFWarnCount = $SPFRecord.ValidationWarns | Measure-Object | Select-Object -ExpandProperty Count
134133
$SPFFailCount = $SPFRecord.ValidationFails | Measure-Object | Select-Object -ExpandProperty Count
134+
$Result.SPFPassAll = $false
135135

136136
if ($SPFFailCount -eq 0) {
137137
$ScoreDomain += $Scores.SPFCorrectAll
138138
$Result.SPFPassAll = $true
139139
} else {
140140
$ScoreExplanation.Add('SPF record did not pass validation') | Out-Null
141141
}
142+
#EndRegion SPF Check
142143

143-
# Get DMARC Record
144+
#Region DMARC Check
144145
try {
145146
$DMARCPolicy = Read-DmarcPolicy -Domain $Domain -ErrorAction Stop
146147

@@ -188,8 +189,9 @@ function Push-DomainAnalyserDomain {
188189
Write-LogMessage -API 'DomainAnalyser' -tenant $DomainObject.TenantId -message $Message -LogData (Get-CippException -Exception $_) -sev Error
189190
#return $Message
190191
}
192+
#EndRegion DMARC Check
191193

192-
# DNS Sec Check
194+
#Region DNS Sec Check
193195
try {
194196
$DNSSECResult = Test-DNSSEC -Domain $Domain -ErrorAction Stop
195197
$DNSSECFailCount = $DNSSECResult.ValidationFails | Measure-Object | Select-Object -ExpandProperty Count
@@ -206,8 +208,9 @@ function Push-DomainAnalyserDomain {
206208
Write-LogMessage -API 'DomainAnalyser' -tenant $DomainObject.TenantId -message $Message -LogData (Get-CippException -Exception $_) -sev Error
207209
#return $Message
208210
}
211+
#EndRegion DNS Sec Check
209212

210-
# DKIM Check
213+
#Region DKIM Check
211214
try {
212215
$DkimParams = @{
213216
Domain = $Domain
@@ -241,7 +244,9 @@ function Push-DomainAnalyserDomain {
241244
Write-LogMessage -API 'DomainAnalyser' -tenant $DomainObject.TenantId -message $Message -LogData (Get-CippException -Exception $_) -sev Error
242245
#return $Message
243246
}
247+
#EndRegion DKIM Check
244248

249+
#Region MSCNAME DKIM Records
245250
# Get Microsoft DKIM CNAME selector Records
246251
# Ugly, but i needed to create a scope/loop i could break out of without breaking the rest of the function
247252
foreach ($d in $Domain) {
@@ -250,7 +255,7 @@ function Push-DomainAnalyserDomain {
250255
if ($Result.DKIMEnabled -eq $true) {
251256
continue
252257
}
253-
# Test if its a onmicrosft.com domain, skip domain if it is
258+
# Test if its a onmicrosoft.com domain, skip domain if it is
254259
if ($Domain -match 'onmicrosoft.com') {
255260
continue
256261
}
@@ -264,28 +269,21 @@ function Push-DomainAnalyserDomain {
264269
}
265270
}
266271

272+
# Get the DKIM record from EXO. This is the only way to get the correct values for the MSCNAME records since the new format was introduced in May 2025.
273+
$DKIM = (New-ExoRequest -tenantid $Tenant.Tenant -cmdlet 'Get-DkimSigningConfig' -Select 'Domain,Selector1CNAME,Selector2CNAME') | Where-Object { $_.Domain -eq $Domain }
267274

268-
# Compute the DKIM CNAME records from $Tenant.InitialDomainName according to this logic: https://learn.microsoft.com/en-us/defender-office-365/email-authentication-dkim-configure#syntax-for-dkim-cname-records
269-
# Test if it has a - in the domain name
270-
if ($Domain -like '*-*') {
271-
Write-Information 'Domain has a - in it. Got to query EXO for the right values'
272-
$DKIM = (New-ExoRequest -tenantid $Tenant.Tenant -cmdlet 'Get-DkimSigningConfig') | Where-Object { $_.Domain -eq $Domain } | Select-Object Domain, Selector1CNAME, Selector2CNAME
273-
274-
# If no DKIM signing record is found, create a new disabled one
275-
if ($null -eq $DKIM) {
276-
Write-Information 'No DKIM record found in EXO - Creating new signing'
277-
$NewDKIMSigningRequest = New-ExoRequest -tenantid $Tenant.Tenant -cmdlet 'New-DkimSigningConfig' -cmdParams @{ KeySize = 2048; DomainName = $Domain; Enabled = $false }
278-
$Selector1Value = $NewDKIMSigningRequest.Selector1CNAME
279-
$Selector2Value = $NewDKIMSigningRequest.Selector2CNAME
280-
} else {
281-
$Selector1Value = $DKIM.Selector1CNAME
282-
$Selector2Value = $DKIM.Selector2CNAME
283-
}
275+
# If no DKIM signing record is found, create a new disabled one
276+
if ($null -eq $DKIM) {
277+
Write-Information 'No DKIM record found in EXO - Creating new signing'
278+
$NewDKIMSigningRequest = New-ExoRequest -tenantid $Tenant.Tenant -cmdlet 'New-DkimSigningConfig' -cmdParams @{ KeySize = 2048; DomainName = $Domain; Enabled = $false }
279+
$Selector1Value = $NewDKIMSigningRequest.Selector1CNAME
280+
$Selector2Value = $NewDKIMSigningRequest.Selector2CNAME
284281
} else {
285-
$Selector1Value = "selector1-$($Domain -replace '\.', '-' )._domainkey.$($Tenant.InitialDomainName)"
286-
$Selector2Value = "selector2-$($Domain -replace '\.', '-' )._domainkey.$($Tenant.InitialDomainName)"
282+
$Selector1Value = $DKIM.Selector1CNAME
283+
$Selector2Value = $DKIM.Selector2CNAME
287284
}
288285

286+
289287
# Create the MSCNAME object
290288
$MSCNAMERecords = [PSCustomObject]@{
291289
Domain = $Domain
@@ -304,7 +302,7 @@ function Push-DomainAnalyserDomain {
304302
Write-LogMessage -API 'DomainAnalyser' -tenant $DomainObject.TenantId -message "MS CNAME DKIM error: $($ErrorMessage.NormalizedError)" -LogData $ErrorMessage -sev Error
305303
}
306304
}
307-
305+
#EndRegion MSCNAME DKIM Records
308306
# Final Score
309307
$Result.Score = $ScoreDomain
310308
$Result.ScorePercentage = [int](($Result.Score / $Result.MaximumScore) * 100)

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Scheduler/Invoke-ListScheduledItems.ps1

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,29 @@ function Invoke-ListScheduledItems {
1414
$Headers = $Request.Headers
1515
Write-LogMessage -headers $Headers -API $APIName -message 'Accessed this API' -Sev 'Debug'
1616

17-
18-
# Interact with query parameters or the body of the request.
19-
$ShowHidden = $Request.Query.ShowHidden ?? $Request.Body.ShowHidden
20-
$Name = $Request.Query.Name ?? $Request.Body.Name
21-
$Type = $Request.Query.Type ?? $Request.Body.Type
22-
2317
$ScheduledItemFilter = [System.Collections.Generic.List[string]]::new()
2418
$ScheduledItemFilter.Add("PartitionKey eq 'ScheduledTask'")
2519

26-
if ($ShowHidden -eq $true) {
27-
$ScheduledItemFilter.Add('Hidden eq true')
20+
$Id = $Request.Query.Id ?? $Request.Body.Id
21+
if ($Id) {
22+
# Interact with query parameters.
23+
$ScheduledItemFilter.Add("RowKey eq '$($Id)'")
2824
} else {
29-
$ScheduledItemFilter.Add('Hidden eq false')
30-
}
25+
# Interact with query parameters or the body of the request.
26+
$ShowHidden = $Request.Query.ShowHidden ?? $Request.Body.ShowHidden
27+
$Name = $Request.Query.Name ?? $Request.Body.Name
28+
$Type = $Request.Query.Type ?? $Request.Body.Type
29+
30+
if ($ShowHidden -eq $true) {
31+
$ScheduledItemFilter.Add('Hidden eq true')
32+
} else {
33+
$ScheduledItemFilter.Add('Hidden eq false')
34+
}
35+
36+
if ($Name) {
37+
$ScheduledItemFilter.Add("Name eq '$($Name)'")
38+
}
3139

32-
if ($Name) {
33-
$ScheduledItemFilter.Add("Name eq '$($Name)'")
3440
}
3541

3642
$Filter = $ScheduledItemFilter -join ' and '
@@ -42,7 +48,7 @@ function Invoke-ListScheduledItems {
4248
} else {
4349
$HiddenTasks = $true
4450
}
45-
$Tasks = Get-CIPPAzDataTableEntity @Table -Filter $Filter | Where-Object { $_.Hidden -ne $HiddenTasks }
51+
$Tasks = Get-CIPPAzDataTableEntity @Table -Filter $Filter
4652
if ($Type) {
4753
$Tasks = $Tasks | Where-Object { $_.command -eq $Type }
4854
}

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-AddSharedMailbox.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Function Invoke-AddSharedMailbox {
2929
Shared = $true
3030
}
3131
$AddSharedRequest = New-ExoRequest -tenantid $Tenant -cmdlet 'New-Mailbox' -cmdParams $BodyToShip
32-
$Body = $Results.Add("Successfully created shared mailbox: $Email.")
32+
$Body = $Results.Add("Successfully created shared mailbox: $Email")
3333
Write-LogMessage -Headers $Headers -API $APIName -tenant $Tenant -message "Created shared mailbox $($MailboxObject.displayName) with email $Email" -Sev 'Info'
3434

3535
# Block sign-in for the mailbox
@@ -38,7 +38,7 @@ Function Invoke-AddSharedMailbox {
3838
$Body = $Results.Add("Blocked sign-in for shared mailbox $Email")
3939
} catch {
4040
$ErrorMessage = Get-CippException -Exception $_
41-
$Message = "Failed to block sign-in for shared mailbox $Email. Error: $($ErrorMessage.NormalizedError)"
41+
$Message = "Failed to block sign-in for shared mailbox $Email Error: $($ErrorMessage.NormalizedError)"
4242
Write-LogMessage -Headers $Headers -API $APIName -tenant $Tenant -message $Message -Sev 'Error' -LogData $ErrorMessage
4343
$Body = $Results.Add($Message)
4444
}

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Email-Exchange/Administration/Invoke-ExecSetOoO.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ Function Invoke-ExecSetOoO {
3030
# User action uses input, edit exchange uses InternalMessage and ExternalMessage
3131
# User action disable OoO doesn't send any input
3232
if ($Request.Body.input) {
33-
$InternalMessage = $Request.Body.input
34-
$ExternalMessage = $Request.Body.input
33+
$SplatParams.InternalMessage = $Request.Body.input
34+
$SplatParams.ExternalMessage = $Request.Body.input
3535
} else {
3636
$InternalMessage = $Request.Body.InternalMessage
3737
$ExternalMessage = $Request.Body.ExternalMessage

0 commit comments

Comments
 (0)