Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
195 commits
Select commit Hold shift + click to select a range
68a6fc3
Remove un-used/overprivileged Mail.Send
rvdwegen Apr 30, 2025
6ce3831
Remove un-used/overprivileged Mail.Send
rvdwegen Apr 30, 2025
5454d32
addition of new options
Zacgoose May 1, 2025
c98fbbe
durable cleanup fix part 2
JohnDuprey May 1, 2025
4e9540c
chore: CRLF to LF
OfficialEsco May 1, 2025
38b1e35
updated mailbox report api for frontend
Zacgoose May 4, 2025
e12b481
fix: alert deduplication logData JSON conversion bug that caused iden…
kris6673 May 5, 2025
bdf1815
change encoding to LF
kris6673 May 5, 2025
63ea0e4
handles individual and multiple values correctly
Zacgoose May 6, 2025
a32bdf9
Merge pull request #1415 from Ren-Roros-Digital/normalize
rvdwegen May 7, 2025
5229aaf
Merge branch 'dev' into fix-alert-deduplication
kris6673 May 7, 2025
11d7a16
Update SAMManifest.json
kris6673 May 7, 2025
01531ac
Merge pull request #1417 from kris6673/fix-alert-deduplication
rvdwegen May 7, 2025
effedec
Refactor password assignment logic in Invoke-ExecJITAdmin function fo…
kris6673 May 7, 2025
bd6aa3e
Refactor New-CIPPTAP to return object thats better to copy in the fro…
kris6673 May 7, 2025
765f70a
chore: SetOoO consistent variables
OfficialEsco May 8, 2025
9bb4001
fix: use correct Intune Template PolicyName
OfficialEsco May 8, 2025
ec3dfb1
feat: Anti-Phishing additional defaults
OfficialEsco May 8, 2025
4722027
Adjusted Microsoft URL's
sfaxluke May 9, 2025
d2ef2a2
fix ninja ms365 admin links
Zacgoose May 10, 2025
2811231
Merge pull request #1423 from Zacgoose/ninja-links
KelvinTegelaar May 12, 2025
7c7e0f4
Merge pull request #1422 from sfaxluke/patch-1
KelvinTegelaar May 12, 2025
173a251
Merge pull request #1421 from Ren-Roros-Digital/AntiPhishing
KelvinTegelaar May 12, 2025
093c146
Merge pull request #1420 from Ren-Roros-Digital/OutOfOffice
KelvinTegelaar May 12, 2025
a62c1ed
Merge pull request #1419 from kris6673/feat-cleaner-TAP-copy
KelvinTegelaar May 12, 2025
49b4772
Merge pull request #1418 from Zacgoose/tenantblockallow-fix
KelvinTegelaar May 12, 2025
133193c
Merge pull request #1416 from Zacgoose/update-mailbox-report
KelvinTegelaar May 12, 2025
5fee4fe
Merge pull request #1414 from Zacgoose/Room-Mailboxes
KelvinTegelaar May 12, 2025
f0c1c68
Update SAMManifest.json
JohnDuprey May 12, 2025
b919903
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP-API into…
JohnDuprey May 12, 2025
f244911
fix: mailbox rules orchestrator cant start multiple times if the user…
kris6673 May 12, 2025
34b3f76
forgive me for i have sinned
kris6673 May 12, 2025
8f8d65d
audit log tenant searches improvements
KelvinTegelaar May 12, 2025
77b65b2
Merge pull request #1 from KelvinTegelaar/dev
Zacgoose May 13, 2025
df997af
Add ip type to returned block/allow listed items
Zacgoose May 13, 2025
316755d
only compare to default policy
kris6673 May 13, 2025
adf260d
feat: Add new Set Exchange Outbound Spam Limits standard
kris6673 May 13, 2025
d5763a0
Fix alert no MFA admin alert
rvdwegen May 13, 2025
0b38f07
Fix alert no MFA user alert
rvdwegen May 13, 2025
31fb2be
Fix 90 Day Guest Filter
CHRIS-BRANNON May 13, 2025
4f3fb33
fix: Remove 'Device' from types in Invoke-ListDeletedItems function
kris6673 May 13, 2025
360dadc
increase concurrency
JohnDuprey May 13, 2025
7b2d292
Fix casing of tenantFilter in Invoke-ExecRestoreDeleted function and …
kris6673 May 14, 2025
3b8bcc2
Add Invoke-RemoveDeletedObject function for permanently deleting dire…
kris6673 May 14, 2025
46124ab
Change so the error is at the end
kris6673 May 14, 2025
ccd9c4f
Enhance user deletion logging in Invoke-RemoveUser function
kris6673 May 14, 2025
2a2c0a3
Merge pull request #1430 from kris6673/fix-del-user-logging
KelvinTegelaar May 15, 2025
f592192
Merge pull request #1429 from kris6673/feat-perma-delete-action
KelvinTegelaar May 15, 2025
e0e15f3
Merge pull request #1428 from kris6673/fix-remove-type
KelvinTegelaar May 15, 2025
a7bd06e
Merge pull request #1427 from CHRIS-BRANNON/dev
KelvinTegelaar May 15, 2025
8679171
Merge pull request #1426 from kris6673/issue4068
KelvinTegelaar May 15, 2025
e4b7e80
Merge pull request #1425 from Zacgoose/tenantblock-fix
KelvinTegelaar May 15, 2025
1efed26
Merge pull request #1424 from kris6673/fix-mailboxrules-orchestrator
KelvinTegelaar May 15, 2025
058d8ef
feat: Add Invoke-ExecSetMailboxEmailSize and Set-CippMaxEmailSize fun…
kris6673 May 15, 2025
7e5fe3c
fix logic for checking existing group membership
lsmith090 May 15, 2025
4b03379
fix logic for checking existing group membership
lsmith090 May 15, 2025
c89da90
Merge branch 'fix-group-addedit' of https://github.com/lsmith090/CIPP…
lsmith090 May 15, 2025
0abaa44
Fix: enable graph part of standard again, now that
kris6673 May 15, 2025
cc8e91f
clumsy looking but functional
kris6673 May 15, 2025
eb9bcaa
Refactor Invoke-ExecDeviceAction and New-CIPPDeviceAction to improve …
kris6673 May 15, 2025
7c09f63
DeviceCodeLogin API
KelvinTegelaar May 16, 2025
d605650
fix: Skype Consumer Interoperability with Teams is no longer supported
OfficialEsco May 16, 2025
6df9611
Merge pull request #1435 from Ren-Roros-Digital/SkypeFix
KelvinTegelaar May 16, 2025
110f073
Merge pull request #1434 from kris6673/feat-intune-primary-user
KelvinTegelaar May 16, 2025
89f8e20
Merge pull request #1433 from kris6673/fix-standard-profile-photo
KelvinTegelaar May 16, 2025
3c66a35
Merge pull request #1431 from kris6673/feat-max-email-size
KelvinTegelaar May 16, 2025
02b234e
fix listgraphrequest alltenants
JohnDuprey May 16, 2025
6998d43
feat: add EntraConnectSyncStatus alert
kris6673 May 16, 2025
8e71041
Add username to TAP response
Zacgoose May 16, 2025
5579488
Fix HaloPSA ticket creation
JohnDuprey May 16, 2025
5f43d86
Added function for Custom Quarantine Policies
ngms-psh May 16, 2025
9e04c5f
Ran Update-StandardsComments
ngms-psh May 16, 2025
58be7ea
Enhance Set-CIPPCalendarPermission to include CanViewPrivateItems par…
Jr7468 May 16, 2025
0695179
new sam wizard steps
KelvinTegelaar May 17, 2025
c7de828
updates to new sam wizard
KelvinTegelaar May 17, 2025
875df46
New APIs for single tenant mode
KelvinTegelaar May 18, 2025
3822556
direct tenant add
KelvinTegelaar May 19, 2025
1947b31
changes
KelvinTegelaar May 19, 2025
e05affb
Return sorted tenant groups
Zacgoose May 19, 2025
4b5b11b
Sort both tenant groups and tenants in a group
Zacgoose May 19, 2025
4954806
brrrrr
Zacgoose May 19, 2025
fef71a1
version update
KelvinTegelaar May 19, 2025
1b4a7a6
Entra Group Auth
JohnDuprey May 19, 2025
a3c90a8
Update Get-GraphToken.ps1
JohnDuprey May 19, 2025
76044a9
Update Test-CIPPAccess.ps1
JohnDuprey May 19, 2025
55c1b0d
fix links
JohnDuprey May 19, 2025
e269eee
remove directTenant from CPV
KelvinTegelaar May 19, 2025
3b66cf0
Add DKIM domain exclusions
kris6673 May 19, 2025
763cb4b
updates
KelvinTegelaar May 19, 2025
d3b92b7
permission sets
JohnDuprey May 20, 2025
288c9ef
app deployment templates
JohnDuprey May 20, 2025
8f5ae25
rename apis
JohnDuprey May 20, 2025
40a5b84
add import logic for AppPermissions
JohnDuprey May 20, 2025
1e982e6
Update Invoke-ExecAppPermissionTemplate.ps1
JohnDuprey May 20, 2025
f871ae2
Update Invoke-ExecAppPermissionTemplate.ps1
JohnDuprey May 20, 2025
c8c04b3
latest execsdsamapp
KelvinTegelaar May 20, 2025
75e73ce
app approval template deployment
JohnDuprey May 20, 2025
497b750
app approval template support
JohnDuprey May 20, 2025
09c821d
app deployment standard tweaks
JohnDuprey May 20, 2025
806de1c
Update Push-CIPPStandard.ps1
JohnDuprey May 21, 2025
62595cc
add more logging
JohnDuprey May 21, 2025
da70c01
fix ninja logging
JohnDuprey May 21, 2025
fd635b6
cleanup logging
JohnDuprey May 21, 2025
67a642f
feat: PhishSimSpoofIntelligence replace switch
OfficialEsco May 21, 2025
895d8d8
feat: PhishingSimulations replace switch
OfficialEsco May 21, 2025
2f6e6ea
add single tenants improvements
KelvinTegelaar May 21, 2025
04ce9f6
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP-API into…
KelvinTegelaar May 21, 2025
d2aac3e
log alerting tweaks
JohnDuprey May 21, 2025
e143126
Merge pull request #1442 from Ren-Roros-Digital/PhishSimSpoofIntellig…
JohnDuprey May 21, 2025
c62ddc4
Merge pull request #1441 from kris6673/dkim-domain-exclusion
JohnDuprey May 21, 2025
b1dea57
Merge pull request #1438 from ngms-psh/feat-Custom-QuarantinePolicies
JohnDuprey May 21, 2025
74ecd5f
Merge pull request #1436 from kris6673/feat-EntraConnectSyncStatus-alert
JohnDuprey May 21, 2025
93c2eff
Merge pull request #1432 from lsmith090/fix-group-addedit
JohnDuprey May 21, 2025
559ee33
Merge pull request #1439 from Jr7468/dev
JohnDuprey May 21, 2025
c493e04
Merge pull request #1437 from Zacgoose/TAP-copy-username
JohnDuprey May 21, 2025
2b04950
update editintunescript to support other script types
JohnDuprey May 21, 2025
a65b81a
notification fixes
KelvinTegelaar May 21, 2025
63e6f41
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP-API into…
KelvinTegelaar May 21, 2025
02be9d3
progress stuffs
kris6673 May 16, 2025
732ad86
feat:Make JIT admin support all tenants view
kris6673 May 21, 2025
0439ff3
Merge pull request #1443 from kris6673/feat-jit-admin-all-tenants-list
JohnDuprey May 21, 2025
46cc031
fix CA check
JohnDuprey May 21, 2025
3e8c11f
feat: add allTenants support for transport rules page
kris6673 May 21, 2025
5640710
Fix up and make a bit prettier
kris6673 May 21, 2025
dc0df58
group template edit support
JohnDuprey May 21, 2025
04c1cb7
Review changes from John
Zacgoose May 22, 2025
e5cb86d
Feat: Add option to set password never expires
kris6673 May 23, 2025
424d89f
feat: add all missing ASR options
kris6673 May 23, 2025
55a3f16
Merge pull request #1440 from Zacgoose/return-sorted-tenant-groups
JohnDuprey May 23, 2025
e7fdbee
fix logging
JohnDuprey May 23, 2025
51c421d
fix named location endpoint for restricted tenant users
JohnDuprey May 23, 2025
85181ac
fix support for addexconnector with limited tenants
JohnDuprey May 23, 2025
b8c4a7d
Merge pull request #1447 from kris6673/issue4100
KelvinTegelaar May 24, 2025
6ac1879
Merge pull request #1446 from kris6673/issue4112
KelvinTegelaar May 24, 2025
ffa67d4
fix: standardize variable casing and return more groupInfo for single…
kris6673 May 24, 2025
2e2aaa8
feat: re-add remove from groups and streamline various variable names…
kris6673 May 24, 2025
6552633
Added api's for custom quarantine policies and global
ngms-psh May 24, 2025
bc9d1f1
Moved from StandardQuarantineTemplate to standalone Function, as it i…
ngms-psh May 24, 2025
9b939c5
Added endpoints for new quarantine policies page.
ngms-psh May 24, 2025
ea04249
New function for add/edit quarantine policies and global settings
ngms-psh May 24, 2025
bf388a7
Updated to use new Set-CIPPQuarantinePolicy function
ngms-psh May 24, 2025
ac8b589
latest dev update
KelvinTegelaar May 26, 2025
19ca56d
updates to caches
KelvinTegelaar May 26, 2025
3de0eae
add goose code: add calculatedGroupType to user group output
kris6673 May 26, 2025
4777f16
casing
kris6673 May 26, 2025
8ef72df
another syntax thing
kris6673 May 26, 2025
a143bbb
keyvault
KelvinTegelaar May 26, 2025
7e45dd7
Merge pull request #1444 from kris6673/feat-TransportRules-alltenants
KelvinTegelaar May 26, 2025
9a7afc8
test
KelvinTegelaar May 26, 2025
a851aa4
fixes new appid
KelvinTegelaar May 26, 2025
be7606c
push
KelvinTegelaar May 26, 2025
c434360
why you no work.
KelvinTegelaar May 26, 2025
b965f1f
correction for custom roles
KelvinTegelaar May 27, 2025
d3e781a
added appid detection to prevent cache hit
KelvinTegelaar May 27, 2025
2c01e62
ExecSamApp
KelvinTegelaar May 27, 2025
94f1013
typo
KelvinTegelaar May 27, 2025
58e3a36
appIdTroubleshooting
KelvinTegelaar May 27, 2025
3af3902
stupid bug
KelvinTegelaar May 27, 2025
0ca55a2
feat: Allow exclude when Group is included
OfficialEsco May 27, 2025
ea12858
Modified to calculate decimalValue from binary
ngms-psh May 27, 2025
cc25135
Convert function are now called using splatting
ngms-psh May 27, 2025
0116284
Modified to use Get-Tenants instead of direct from table
ngms-psh May 27, 2025
869354a
add troubleshooting around kv secret add.
KelvinTegelaar May 27, 2025
84e747d
changes for kv
KelvinTegelaar May 27, 2025
95f17b3
good catch john
KelvinTegelaar May 27, 2025
bc71243
direct tenant token refreshes
JohnDuprey May 27, 2025
f93af7c
add automatic secret rotation
JohnDuprey May 27, 2025
fd3834a
Update Start-UpdateTokensTimer.ps1
JohnDuprey May 27, 2025
d57feaa
logbook improvements
JohnDuprey May 27, 2025
7027184
fix group issues
JohnDuprey May 27, 2025
769cf07
improve logging
JohnDuprey May 27, 2025
54d02c5
cleanup classic api token usage
JohnDuprey May 27, 2025
5520165
add sherweb to add user task
JohnDuprey May 27, 2025
e7cc8a0
fix edit protection policies
JohnDuprey May 27, 2025
0ff5451
update cpv to support directTenant
JohnDuprey May 27, 2025
b2972fc
update dnshealth
JohnDuprey May 27, 2025
02a318b
fix cpv refresh for direct tenant
JohnDuprey May 27, 2025
512464b
corrected token generation
KelvinTegelaar May 28, 2025
2003b81
removed troubleshooting info
KelvinTegelaar May 28, 2025
6242c7f
Merge pull request #1450 from ngms-psh/feat-Custom-QuarantinePolicies
KelvinTegelaar May 28, 2025
e8d61cc
Merge pull request #1451 from Ren-Roros-Digital/GroupExclude
KelvinTegelaar May 28, 2025
925b6bc
fix bulk assign licenses
KelvinTegelaar May 28, 2025
6fc2c42
fixes license assign
KelvinTegelaar May 28, 2025
fe39335
fixes https://github.com/KelvinTegelaar/CIPP/issues/4031
KelvinTegelaar May 28, 2025
1c82197
Merge branch 'dev' into groupinfo-single-group
kris6673 May 28, 2025
f86543a
Merge pull request #1449 from kris6673/feat-removeFromGroups
KelvinTegelaar May 28, 2025
4735be7
add more tables to backup
JohnDuprey May 28, 2025
41cc557
cleanup rule tweak
JohnDuprey May 28, 2025
8e64a0c
Update Invoke-ListLogs.ps1
JohnDuprey May 28, 2025
083400f
fix filters
JohnDuprey May 28, 2025
56db9be
Merge pull request #1448 from kris6673/groupinfo-single-group
KelvinTegelaar May 28, 2025
7fe5d5c
push version
KelvinTegelaar May 28, 2025
e3c423d
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP-API into…
KelvinTegelaar May 28, 2025
b579ef9
cleanup duplicate auth checks
JohnDuprey May 28, 2025
b9c3159
Merge pull request #1452 from KelvinTegelaar/dev
KelvinTegelaar May 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10,700 changes: 5,350 additions & 5,350 deletions Cache_SAMSetup/PermissionsTranslator.json

Large diffs are not rendered by default.

387 changes: 193 additions & 194 deletions Cache_SAMSetup/SAMManifest.json

Large diffs are not rendered by default.

71 changes: 71 additions & 0 deletions Modules/CIPPCore/Private/Convert-QuarantinePermissionsValue.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
function Convert-QuarantinePermissionsValue {
[CmdletBinding(DefaultParameterSetName = 'DecimalValue')]
param (
[Parameter(Mandatory, Position = 0, ParameterSetName = "StringValue")]
[ValidateNotNullOrEmpty()]
[string]$InputObject,

[Parameter(Position = 0, ParameterSetName = "DecimalValue")]
[int]$PermissionToViewHeader = 0,
[Parameter(Position = 1, ParameterSetName = "DecimalValue")]
[int]$PermissionToDownload = 0,
[Parameter(Mandatory, Position = 2, ParameterSetName = "DecimalValue")]
[int]$PermissionToAllowSender,
[Parameter(Mandatory, Position = 3, ParameterSetName = "DecimalValue")]
[int]$PermissionToBlockSender,
[Parameter(Mandatory, Position = 4, ParameterSetName = "DecimalValue")]
[int]$PermissionToRequestRelease,
[Parameter(Mandatory, Position = 5, ParameterSetName = "DecimalValue")]
[int]$PermissionToRelease,
[Parameter(Mandatory, Position = 6, ParameterSetName = "DecimalValue")]
[int]$PermissionToPreview,
[Parameter(Mandatory, Position = 7, ParameterSetName = "DecimalValue")]
[int]$PermissionToDelete
)

#Converts string value with EndUserQuarantinePermissions received from Get-QuarantinePolicy
if (($PSCmdlet.ParameterSetName) -eq "StringValue") {
try {
# Remove square brackets and split into lines
$InputObject = $InputObject.Trim('[', ']')
$hashtable = @{}
$InputObject -split "`n" | ForEach-Object {
$key, $value = $_ -split ":\s*"
$hashtable[$key.Trim()] = [System.Convert]::ToBoolean($value.Trim())
}
return $hashtable
}
catch {
throw "Convert-QuarantinePermissionsValue: Failed to convert string to hashtable."
}
}

#Converts selected end user quarantine permissions to decimal value used by EndUserQuarantinePermissionsValue property in New-QuarantinePolicy and Set-QuarantinePolicy
elseif (($PSCmdlet.ParameterSetName) -eq "DecimalValue") {
try {
# both PermissionToRequestRelease and PermissionToRelease cannot be set to true at the same time
if($PermissionToRequestRelease -eq 1 -and $PermissionToRelease -eq 1) {
throw "PermissionToRequestRelease and PermissionToRelease cannot both be set to true."
}

# Convert each permission to a binary string
$BinaryValue = [string]@(
$PermissionToViewHeader,
$PermissionToDownload,
$PermissionToAllowSender,
$PermissionToBlockSender,
$PermissionToRequestRelease,
$PermissionToRelease,
$PermissionToPreview,
$PermissionToDelete
) -replace '\s',''

# Convert the binary string to an Decimal value
return [convert]::ToInt32($BinaryValue,2)
}
catch {
$ErrorMessage = Get-NormalizedError -Message $_.Exception.Message
throw "Convert-QuarantinePermissionsValue: Failed to convert QuarantinePermissions to QuarantinePermissionsValue. Error: $ErrorMessage"
}
}
}
30 changes: 29 additions & 1 deletion Modules/CIPPCore/Public/Add-CIPPApplicationPermission.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ function Add-CIPPApplicationPermission {
[CmdletBinding()]
param(
$RequiredResourceAccess,
$TemplateId,
$ApplicationId,
$Tenantfilter
)
Expand Down Expand Up @@ -31,7 +32,34 @@ function Add-CIPPApplicationPermission {

$RequiredResourceAccess.Add($Resource)
}
} else {
if (!$RequiredResourceAccess -and $TemplateId) {
Write-Information "Adding application permissions for template $TemplateId"
$TemplateTable = Get-CIPPTable -TableName 'templates'
$Filter = "RowKey eq '$TemplateId' and PartitionKey eq 'AppApprovalTemplate'"
$Template = (Get-CIPPAzDataTableEntity @TemplateTable -Filter $Filter).JSON | ConvertFrom-Json -ErrorAction SilentlyContinue
$ApplicationId = $Template.AppId
$Permissions = $Template.Permissions
$RequiredResourceAccess = [System.Collections.Generic.List[object]]::new()
foreach ($AppId in $Permissions.PSObject.Properties.Name) {
$AppPermissions = @($Permissions.$AppId.applicationPermissions)
$Resource = @{
resourceAppId = $AppId
resourceAccess = [System.Collections.Generic.List[object]]::new()
}
foreach ($Permission in $AppPermissions) {
$Resource.ResourceAccess.Add(@{
id = $Permission.id
type = 'Role'
})
}

$RequiredResourceAccess.Add($Resource)
}
}
}


$ServicePrincipalList = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/servicePrincipals?`$select=AppId,id,displayName&`$top=999" -skipTokenCache $true -tenantid $Tenantfilter -NoAuthCheck $true
$ourSVCPrincipal = $ServicePrincipalList | Where-Object -Property AppId -EQ $ApplicationId
if (!$ourSVCPrincipal) {
Expand Down Expand Up @@ -59,7 +87,7 @@ function Add-CIPPApplicationPermission {
}
}
foreach ($SingleResource in $App.ResourceAccess | Where-Object -Property Type -EQ 'Role') {
if ($SingleResource.id -In $CurrentRoles.appRoleId) { continue }
if ($SingleResource.id -in $CurrentRoles.appRoleId) { continue }
[pscustomobject]@{
principalId = $($ourSVCPrincipal.id)
resourceId = $($svcPrincipalId.id)
Expand Down
29 changes: 29 additions & 0 deletions Modules/CIPPCore/Public/Add-CIPPDelegatedPermission.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ function Add-CIPPDelegatedPermission {
[CmdletBinding()]
param(
$RequiredResourceAccess,
$TemplateId,
$ApplicationId,
$NoTranslateRequired,
$Tenantfilter
Expand Down Expand Up @@ -40,7 +41,34 @@ function Add-CIPPDelegatedPermission {
# remove the partner center permission if not pushing to partner tenant
$RequiredResourceAccess = $RequiredResourceAccess | Where-Object { $_.resourceAppId -ne 'fa3d9a0c-3fb0-42cc-9193-47c7ecd2edbd' }
}
} else {
if (!$RequiredResourceAccess -and $TemplateId) {
Write-Information "Adding delegated permissions for template $TemplateId"
$TemplateTable = Get-CIPPTable -TableName 'templates'
$Filter = "RowKey eq '$TemplateId' and PartitionKey eq 'AppApprovalTemplate'"
$Template = (Get-CIPPAzDataTableEntity @TemplateTable -Filter $Filter).JSON | ConvertFrom-Json -ErrorAction SilentlyContinue
$ApplicationId = $Template.AppId
$Permissions = $Template.Permissions
$NoTranslateRequired = $true
$RequiredResourceAccess = [System.Collections.Generic.List[object]]::new()
foreach ($AppId in $Permissions.PSObject.Properties.Name) {
$DelegatedPermissions = @($Permissions.$AppId.delegatedPermissions)
$ResourceAccess = [System.Collections.Generic.List[object]]::new()
foreach ($Permission in $DelegatedPermissions) {
$ResourceAccess.Add(@{
id = $Permission.value
type = 'Scope'
})
}
$Resource = @{
resourceAppId = $AppId
resourceAccess = @($ResourceAccess)
}
$RequiredResourceAccess.Add($Resource)
}
}
}

$Translator = Get-Content '.\PermissionsTranslator.json' | ConvertFrom-Json
$ServicePrincipalList = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/servicePrincipals?`$select=appId,id,displayName&`$top=999" -tenantid $Tenantfilter -skipTokenCache $true -NoAuthCheck $true
$ourSVCPrincipal = $ServicePrincipalList | Where-Object -Property appId -EQ $ApplicationId
Expand All @@ -66,6 +94,7 @@ function Add-CIPPDelegatedPermission {
}

$DelegatedScopes = $App.resourceAccess | Where-Object -Property type -EQ 'Scope'

if ($NoTranslateRequired) {
$NewScope = @($DelegatedScopes | ForEach-Object { $_.id } | Sort-Object -Unique) -join ' '
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

function Get-CIPPAlertEntraConnectSyncStatus {
<#
.FUNCTIONALITY
Entrypoint
#>
[CmdletBinding()]
param(
[Parameter(Mandatory = $false)]
[Alias('input')]
$InputValue,
$TenantFilter
)
try {
# Set Hours with fallback to 72 hours
$Hours = if ($InputValue) { [int]$InputValue } else { 72 }
$ConnectSyncStatus = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/organization?$select=onPremisesLastPasswordSyncDateTime,onPremisesLastSyncDateTime,onPremisesSyncEnabled' -tenantid $TenantFilter

if ($ConnectSyncStatus.onPremisesSyncEnabled -eq $true) {
$LastPasswordSync = $ConnectSyncStatus.onPremisesLastPasswordSyncDateTime
$SyncDateTime = $ConnectSyncStatus.onPremisesLastSyncDateTime
# Get the older of the two sync times
$LastSync = if ($SyncDateTime -lt $LastPasswordSync) { $SyncDateTime } else { $LastPasswordSync }

if ($LastSync -lt (Get-Date).AddHours(-$Hours).ToUniversalTime()) {
$AlertData = "Entra Connect Sync for $($TenantFilter) has not run for over $Hours hours. Last sync was at $($LastSync.ToString('o'))"
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
}
}
} catch {
Write-AlertMessage -tenant $($TenantFilter) -message "Could not get Entra Connect Sync Status for $($TenantFilter): $(Get-NormalizedError -message $_.Exception.message)"
}
}
2 changes: 1 addition & 1 deletion Modules/CIPPCore/Public/Alerts/Get-CIPPAlertMFAAdmins.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function Get-CIPPAlertMFAAdmins {
}
}
if (!$DuoActive) {
$users = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/reports/authenticationMethods/userRegistrationDetails?`$top=999&filter=IsAdmin eq true and isMfaRegistered eq false and userType eq 'member'&`$select=userPrincipalName,lastUpdatedDateTime,isMfaRegistered,IsAdmin" -tenantid $($TenantFilter) -AsApp $true | Where-Object { $_.userDisplayName -ne 'On-Premises Directory Synchronization Service Account' }
$users = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/reports/authenticationMethods/userRegistrationDetails?`$top=999&filter=IsAdmin eq true and isMfaRegistered eq false and userType eq 'member'&`$select=userDisplayName,userPrincipalName,lastUpdatedDateTime,isMfaRegistered,IsAdmin" -tenantid $($TenantFilter) -AsApp $true | Where-Object { $_.userDisplayName -ne 'On-Premises Directory Synchronization Service Account' }
if ($users.UserPrincipalName) {
$AlertData = "The following admins do not have MFA registered: $($users.UserPrincipalName -join ', ')"
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function Get-CIPPAlertMFAAlertUsers {
)
try {

$users = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/reports/authenticationMethods/userRegistrationDetails?`$top=999&filter=IsAdmin eq false and isMfaRegistered eq false and userType eq 'member'&`$select=userPrincipalName,lastUpdatedDateTime,isMfaRegistered,IsAdmin" -tenantid $($TenantFilter) -AsApp $true | Where-Object { $_.userDisplayName -ne 'On-Premises Directory Synchronization Service Account' }
$users = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/reports/authenticationMethods/userRegistrationDetails?`$top=999&filter=IsAdmin eq false and isMfaRegistered eq false and userType eq 'member'&`$select=userDisplayName,userPrincipalName,lastUpdatedDateTime,isMfaRegistered,IsAdmin" -tenantid $($TenantFilter) -AsApp $true | Where-Object { $_.userDisplayName -ne 'On-Premises Directory Synchronization Service Account' }
if ($users.UserPrincipalName) {
$AlertData = "The following $($users.Count) users do not have MFA registered: $($users.UserPrincipalName -join ', ')"
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
Expand Down
42 changes: 42 additions & 0 deletions Modules/CIPPCore/Public/Authentication/Get-CIPPAccessRole.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
function Get-CIPPAccessRole {
<#
.SYNOPSIS
Get the access role for the current user

.DESCRIPTION
Get the access role for the current user

.PARAMETER TenantID
The tenant ID to check the access role for

.EXAMPLE
Get-CippAccessRole -UserId $UserId

.FUNCTIONALITY
Internal
#>
[CmdletBinding()]
param($Request)

$CacheAccessUserRoleTable = Get-CIPPTable -tablename 'cacheAccessUserRole'
$CachedRoles = Get-CIPPAzDataTableEntity @CacheAccessUserRoleTable -Filter "PartitionKey eq 'AccessUser' and RowKey eq '$($Request.Headers.'x-ms-client-principal-name')'" | Select-Object -ExpandProperty Role | ConvertFrom-Json

$SwaCreds = ([System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($request.headers.'x-ms-client-principal')) | ConvertFrom-Json)
$SwaRoles = $SwaCreds.userRoles

# Combine SWA roles and cached roles into a single deduplicated list
$AllRoles = [System.Collections.Generic.List[string]]::new()
if ($null -ne $SwaRoles) {
$AllRoles.AddRange($SwaRoles)
}
if ($null -ne $CachedRoles) {
$AllRoles.AddRange($CachedRoles)
}

# Remove duplicates and ensure we have a clean array
$CombinedRoles = $AllRoles | Select-Object -Unique

# For debugging
Write-Information "Combined Roles: $($CombinedRoles -join ', ')"
return $CombinedRoles
}
51 changes: 51 additions & 0 deletions Modules/CIPPCore/Public/Authentication/Set-CIPPAccessRole.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
function Set-CIPPAccessRole {
<#
.SYNOPSIS
Set the access role mappings

.DESCRIPTION
Set the access role mappings for Entra groups

.PARAMETER Role
The role to set (e.g. 'superadmin','admin','editor','readonly','customrole')

.PARAMETER Group
The Entra group to set the role for

.FUNCTIONALITY
Internal
#>
[CmdletBinding(SupportsShouldProcess = $true)]
Param(
[Parameter(Mandatory = $true)]
[string]$Role,
[Parameter(Mandatory = $true)]
[string]$Group
)

$BlacklistedRoles = @('authenticated', 'anonymous')

if ($BlacklistedRoles -contains $Role) {
throw 'Role group cannot be set for authenticated or anonymous roles'
}

if (!$Group.id -or !$Group.displayName) {
throw 'Group is not valid'
}

$Role = $Role.ToLower().Trim() -replace ' ', ''

$Table = Get-CippTable -TableName AccessRoleGroups
$AccessGroup = Get-CIPPAzDataTableEntity @Table -Filter "RowKey = '$Role'"

$AccessGroup = [PSCustomObject]@{
PartitionKey = [string]'AccessRole'
RowKey = [string]$Role
GroupId = [string]$Group.id
GroupName = [string]$Group.displayName
}

if ($PSCmdlet.ShouldProcess("Setting access role $Role for group $($Group.displayName)")) {
Add-CIPPAzDataTableEntity -Table $Table -Entity $AccessGroup -Force
}
}
Loading