Skip to content

[pull] master from KelvinTegelaar:master #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 190 commits into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
190 commits
Select commit Hold shift + click to select a range
65d7c1f
Update Invoke-CIPPStandardcalDefault.ps1
JohnDuprey Mar 7, 2025
f5e78da
Update Clear-CippDurables.ps1
JohnDuprey Mar 7, 2025
7fe6a93
add excludedTenants
KelvinTegelaar Mar 7, 2025
ba8ebcb
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP-API into…
KelvinTegelaar Mar 7, 2025
624dc2d
excluded tennats alerts
KelvinTegelaar Mar 7, 2025
ee17e66
add exlcuded tenant to list
KelvinTegelaar Mar 7, 2025
5a3a512
add string formatting for replacemap
JohnDuprey Mar 7, 2025
302a8dc
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP-API into…
JohnDuprey Mar 7, 2025
b3fee16
add sherweb exception
JohnDuprey Mar 7, 2025
7ce8212
Update Set-SherwebSubscription.ps1
JohnDuprey Mar 7, 2025
c73735f
Enhance P1 license utilization check to include P2 licenses
kris6673 Mar 7, 2025
93d5064
Create upload_dev
JohnDuprey Mar 7, 2025
821bbe1
Rename upload_dev to upload_dev.yml
JohnDuprey Mar 7, 2025
61b7f5c
Merge pull request #1343 from kris6673/fix-entra-license-alert
JohnDuprey Mar 7, 2025
ff2ff18
Fix Name Filter
CHRIS-BRANNON Mar 7, 2025
48cd7f2
Delete old queue files
kris6673 Mar 8, 2025
c963122
fix a bunch of stuff with alerts and incidents and refactore some log…
kris6673 Mar 8, 2025
33891af
wtf i made someting that works with alltenants
kris6673 Mar 8, 2025
3549d9f
Add sorting
kris6673 Mar 8, 2025
fe60e27
fix DurableName
kris6673 Mar 8, 2025
36843d3
Refactor Invoke-ListMailQuarantine to exclude unnecessary data type p…
kris6673 Mar 8, 2025
43c22f5
feat: Added DoNotRewriteUrls to SafeLinks
OfficialEsco Mar 8, 2025
d176322
Proper support for not starting multiple orchestrators
kris6673 Mar 8, 2025
99ff31f
feat: Added AllowedSenderDomains to SpamFilter
OfficialEsco Mar 8, 2025
7aca312
fix dumb
kris6673 Mar 8, 2025
b300ce2
add alert for new Defender Incidents
kris6673 Mar 8, 2025
6fe4a92
Merge pull request #1344 from CHRIS-BRANNON/dev
KelvinTegelaar Mar 9, 2025
180e34c
Merge pull request #1345 from Ren-Roros-Digital/DoNotRewriteUrls
KelvinTegelaar Mar 9, 2025
fcb0fa4
Merge pull request #1346 from kris6673/incidents-alerts
KelvinTegelaar Mar 9, 2025
233eae4
added days to lit hold
KelvinTegelaar Mar 9, 2025
8f2841f
delete device
KelvinTegelaar Mar 9, 2025
83c33bd
update for sendonbehalf
KelvinTegelaar Mar 9, 2025
6c8285d
adds mailbox info payload
KelvinTegelaar Mar 9, 2025
08d45c5
Fix for point 2 in https://github.com/KelvinTegelaar/CIPP/issues/3767
kris6673 Mar 9, 2025
acb3c7f
dont change the state of account enabled when patching
KelvinTegelaar Mar 10, 2025
3536fe4
fixes name unallowed characters
KelvinTegelaar Mar 10, 2025
91d48b0
fixes issue with multiple groups
KelvinTegelaar Mar 11, 2025
ac8901f
fix bpa run without templates imported
JohnDuprey Mar 11, 2025
90b3232
fix: MFA alerts and BPA report for mfa reg
JohnDuprey Mar 11, 2025
e76c738
fix: audit log search creation, pk filter
JohnDuprey Mar 11, 2025
4500250
fix: smtp report logging
JohnDuprey Mar 11, 2025
bb3ecd3
fix: double /r in pwpush link
JohnDuprey Mar 11, 2025
97a5702
anchor tweak
JohnDuprey Mar 11, 2025
e3c4678
fix: set-transportrule identity error
JohnDuprey Mar 11, 2025
8d5c5d4
move gdap check outside of loop
JohnDuprey Mar 11, 2025
8917683
compare objects
KelvinTegelaar Mar 11, 2025
db2436b
fix: compliance center anchor
JohnDuprey Mar 12, 2025
eecc5d0
permission fixes
JohnDuprey Mar 12, 2025
48312ed
added replacement map
KelvinTegelaar Mar 12, 2025
ce9d7f9
Merge pull request #1347 from kris6673/ExecEditCalendarPermissions
KelvinTegelaar Mar 12, 2025
8bc4a0f
fix my dumb
kris6673 Mar 12, 2025
fc6b948
Update Get-CIPPLAPSPassword.ps1
JohnDuprey Mar 12, 2025
0620eef
fix: use app permissions
JohnDuprey Mar 12, 2025
935faa7
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP-API into…
KelvinTegelaar Mar 12, 2025
659bdad
adds ability for compare.
KelvinTegelaar Mar 12, 2025
0904ab3
feat: function cleanup, add AnyTenant to functionality
JohnDuprey Mar 10, 2025
9c8c46f
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP-API into…
JohnDuprey Mar 12, 2025
82c6a0f
Update Invoke-AddGroup.ps1
JohnDuprey Mar 10, 2025
a826da6
add public role
JohnDuprey Mar 9, 2025
9968a46
Merge pull request #1348 from kris6673/dev
JohnDuprey Mar 12, 2025
f7540a7
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP-API into…
JohnDuprey Mar 12, 2025
5bd7b4b
fix permissions
JohnDuprey Mar 12, 2025
84e8f2d
functionize text replacement
JohnDuprey Mar 12, 2025
78f523a
feat: edit tenant /tenant groups
JohnDuprey Mar 13, 2025
0a6cdc1
feat: include global variables
JohnDuprey Mar 13, 2025
6291ef2
feat: full tenant group management
JohnDuprey Mar 13, 2025
d2f28eb
Update Invoke-EditTenant.ps1
JohnDuprey Mar 13, 2025
48e15d5
Update Invoke-CIPPStandardIntuneTemplate.ps1
JohnDuprey Mar 13, 2025
a7aee30
feat: tenant group support in standards
JohnDuprey Mar 13, 2025
bd2afc2
feat: improve text replacements in Graph Request
JohnDuprey Mar 13, 2025
08bd618
Fixed incorrect capitalisations of product names
swanny246 Mar 14, 2025
4dd19b8
add support for piping and positional params
kris6673 Mar 14, 2025
dd9c5e9
fix cmdlet needs proxy errors and improve logging
kris6673 Mar 14, 2025
05c07d9
Remove again since it's unneeded
kris6673 Mar 14, 2025
9d0c671
feat: custom data management
JohnDuprey Mar 14, 2025
5099c20
feat: directory extension support
JohnDuprey Mar 14, 2025
167206d
feat: list custom attributes
JohnDuprey Mar 14, 2025
37c7799
Update Get-CippCustomDataAttributes.ps1
JohnDuprey Mar 14, 2025
78f7154
per user mfa changes per MS's requests
KelvinTegelaar Mar 14, 2025
431c3ea
fix mfa report
KelvinTegelaar Mar 14, 2025
f2243ef
MFA state updates
KelvinTegelaar Mar 14, 2025
a0428c7
Merge pull request #1351 from isgq-github01/dev
KelvinTegelaar Mar 14, 2025
27ae086
start of alerting changes
KelvinTegelaar Mar 14, 2025
aefbb65
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP-API into…
KelvinTegelaar Mar 14, 2025
19c2893
fix classic function
JohnDuprey Mar 14, 2025
32c0719
feat: add AllowList in Invoke-CIPPStandardSpoofWarn standard
kris6673 Mar 15, 2025
7fc53fd
feat: get license name from admin portal
JohnDuprey Mar 15, 2025
85a265c
Update Get-CIPPLicenseOverview.ps1
JohnDuprey Mar 15, 2025
2a27787
add more data to function offloading
JohnDuprey Mar 16, 2025
7efd8f3
Update Invoke-ExecOffloadFunctions.ps1
JohnDuprey Mar 16, 2025
0b5e569
Update Invoke-ExecOffloadFunctions.ps1
JohnDuprey Mar 16, 2025
9976aff
Update Invoke-ExecOffloadFunctions.ps1
JohnDuprey Mar 16, 2025
38c4374
Merge pull request #1354 from kris6673/spoof-warn
KelvinTegelaar Mar 16, 2025
4176d85
Merge pull request #1352 from kris6673/fix-AuditLog
KelvinTegelaar Mar 16, 2025
47d7c48
Update licenses to newest version
kris6673 Mar 16, 2025
1b7c61c
updates html
KelvinTegelaar Mar 16, 2025
756ffe1
improved appid
KelvinTegelaar Mar 17, 2025
f5849d4
Merge pull request #1355 from kris6673/chore-license-update
KelvinTegelaar Mar 17, 2025
d4fec2a
updates to standards alerting
KelvinTegelaar Mar 17, 2025
36bfe09
fix: gdap relationships with no mappings
JohnDuprey Mar 17, 2025
943cbcd
minor changes
KelvinTegelaar Mar 17, 2025
4707a6a
CIPP-API fixes
JohnDuprey Mar 17, 2025
0329521
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP-API into…
JohnDuprey Mar 17, 2025
dc9ad98
Update Invoke-ExecApiClient.ps1
JohnDuprey Mar 17, 2025
bc780d7
fix: new-cippcapolicy
JohnDuprey Mar 17, 2025
52cc918
fixes edit business phones
KelvinTegelaar Mar 18, 2025
ba335ea
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP-API into…
KelvinTegelaar Mar 18, 2025
5d3677f
contact tweaks
JohnDuprey Mar 18, 2025
0659f95
durable cleanup
JohnDuprey Mar 18, 2025
52cde90
EditGroup go brrrr
JohnDuprey Mar 18, 2025
611f741
fix add group members/owners
JohnDuprey Mar 18, 2025
41bae3e
tmppush
KelvinTegelaar Mar 18, 2025
3ad424d
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP-API into…
KelvinTegelaar Mar 18, 2025
cb518e5
rename
KelvinTegelaar Mar 19, 2025
e73b44c
push
KelvinTegelaar Mar 19, 2025
a4a1e15
fix listgroup
JohnDuprey Mar 19, 2025
3ba75b7
pushing
KelvinTegelaar Mar 19, 2025
205dc39
standards
KelvinTegelaar Mar 19, 2025
5bfc23f
updated standards
JohnDuprey Mar 19, 2025
568d1b8
more standards
JohnDuprey Mar 19, 2025
8e7d901
more standards
JohnDuprey Mar 19, 2025
de27394
add cipp functions
JohnDuprey Mar 19, 2025
fa8aeb5
more standards
JohnDuprey Mar 19, 2025
73f5001
fix exo bulk request
JohnDuprey Mar 19, 2025
57de674
add new endpoint for listing extension cache data
JohnDuprey Mar 19, 2025
c0eae0f
Update New-ExoBulkRequest.ps1
JohnDuprey Mar 19, 2025
d585ae2
custom data mapping
JohnDuprey Mar 20, 2025
9267652
Update Register-CippExtensionScheduledTasks.ps1
JohnDuprey Mar 20, 2025
e1a26bc
custom data sync tweaks
JohnDuprey Mar 20, 2025
0aeb167
fix: please stop disabling my reactivated guests
OfficialEsco Mar 20, 2025
44c8c43
custom data tweaks
JohnDuprey Mar 20, 2025
3626906
fix graph preset saving
JohnDuprey Mar 20, 2025
77a6312
standards fields
KelvinTegelaar Mar 20, 2025
9d95cad
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP-API into…
JohnDuprey Mar 20, 2025
d029fa4
fix bulk requests
JohnDuprey Mar 20, 2025
0400251
fix: object prop updated by ref causing table err
JohnDuprey Mar 20, 2025
5a2cef7
more custom data actions
JohnDuprey Mar 20, 2025
3d5569d
Update Invoke-ExecCustomData.ps1
JohnDuprey Mar 20, 2025
7b0fd03
Update Invoke-ExecCustomData.ps1
JohnDuprey Mar 20, 2025
e566c5f
fix businessPhones
JohnDuprey Mar 20, 2025
a44aaa5
create add tenant api
JohnDuprey Mar 21, 2025
1469ea8
standards updates
KelvinTegelaar Mar 21, 2025
ff33992
standards
KelvinTegelaar Mar 21, 2025
02f81c3
fix last standards
KelvinTegelaar Mar 21, 2025
4a4888c
fix hibp auth
JohnDuprey Mar 21, 2025
6b6a3c0
fix casing on UploadApplication
JohnDuprey Mar 21, 2025
cde0cd3
add mfa service policy check
JohnDuprey Mar 21, 2025
948519b
fix winget bug
JohnDuprey Mar 21, 2025
e81af7f
fix responses
JohnDuprey Mar 21, 2025
438edcc
cleanup partner detection
JohnDuprey Mar 21, 2025
49b6099
add location data check when CIPPGeoLocation is a condition
JohnDuprey Mar 22, 2025
fa20803
audit log tweaks
JohnDuprey Mar 22, 2025
e99e8c6
sorting
JohnDuprey Mar 22, 2025
2416985
Update Test-CIPPAuditLogRules.ps1
JohnDuprey Mar 23, 2025
cb0250f
add delete invite
JohnDuprey Mar 23, 2025
b03cb9a
fix access assignments check
JohnDuprey Mar 23, 2025
66e34f4
new function for managing access assignments
JohnDuprey Mar 23, 2025
5d0d12a
Update Invoke-ExecGDAPAccessAssignment.ps1
JohnDuprey Mar 23, 2025
ef88031
gdap role mapping
JohnDuprey Mar 23, 2025
581ea51
gdap tweaks
JohnDuprey Mar 23, 2025
e96cc95
Update Test-CIPPAuditLogRules.ps1
JohnDuprey Mar 23, 2025
f3427ab
fix: please stop fighting with On-Premise shared mailboxes
OfficialEsco Mar 20, 2025
e110e63
Update Test-CIPPAuditLogRules.ps1
JohnDuprey Mar 24, 2025
8211b1b
fixes for standard states
KelvinTegelaar Mar 24, 2025
7dad69a
fix: support multiple azure subscriptions
JohnDuprey Mar 24, 2025
322b6ad
fix: part 2
JohnDuprey Mar 24, 2025
f4a0434
improvements to shown data
KelvinTegelaar Mar 24, 2025
baf275c
hosted tweaks
JohnDuprey Mar 24, 2025
c969bcf
typo
JohnDuprey Mar 24, 2025
26d556b
fix: save template
JohnDuprey Mar 24, 2025
0214416
fixed issues with standards not reporting correctly.
KelvinTegelaar Mar 24, 2025
9f6e536
fix scheduler sorting
JohnDuprey Mar 24, 2025
fa8ece4
add tenantid to access check
JohnDuprey Mar 24, 2025
1751bc2
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP-API into…
JohnDuprey Mar 24, 2025
773b5e8
fix intune compare and template deployment
KelvinTegelaar Mar 24, 2025
4152ddd
fix one drive shortcut name
JohnDuprey Mar 24, 2025
90452a2
improved html
KelvinTegelaar Mar 24, 2025
63e559d
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP-API into…
KelvinTegelaar Mar 24, 2025
c464bb1
switch to app permissions
JohnDuprey Mar 25, 2025
4b7e00c
Update Invoke-ExecSendPush.ps1
JohnDuprey Mar 25, 2025
ba19ea8
add SecurityAnalyzedMessage.ReadWrite.All
JohnDuprey Mar 25, 2025
3a9be9d
fix: exo issues with calendars and bulk request
JohnDuprey Mar 25, 2025
e7bc5be
fix: edit group add and remove owner in same request
JohnDuprey Mar 25, 2025
3850f1c
fixes for long emails
KelvinTegelaar Mar 25, 2025
606c026
updated standard alert objects
JohnDuprey Mar 25, 2025
571c555
Merge branch 'dev' of https://github.com/KelvinTegelaar/CIPP-API into…
JohnDuprey Mar 25, 2025
1b33a14
version up.
KelvinTegelaar Mar 25, 2025
9502e20
Merge pull request #1357 from Ren-Roros-Digital/DisableGuests
JohnDuprey Mar 25, 2025
63b5cf5
Merge pull request #1356 from Ren-Roros-Digital/DisableSharedMailbox
KelvinTegelaar Mar 25, 2025
c89c54a
Merge pull request #1359 from KelvinTegelaar/dev
KelvinTegelaar Mar 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
36 changes: 36 additions & 0 deletions .github/workflows/upload_dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Upload Dev zip

on:
push:
branches:
- dev

jobs:
release:
if: github.event.repository.fork == false && github.event_name == 'push'
name: Upload to Azure
runs-on: ubuntu-latest

steps:
# Checkout the repository
- name: Checkout Code
uses: actions/checkout@v3

# Create ZIP File in a New Source Directory
- name: Prepare and Zip Release Files
run: |
mkdir -p src/releases
zip -r src/releases/dev.zip . \
--exclude "./src/releases/*" \
--exclude ".*" \
--exclude ".*/**"

# Upload to Azure Blob Storage
- name: Azure Blob Upload with Destination folder defined
uses: LanceMcCarthy/[email protected]
with:
connection_string: ${{ secrets.AZURE_CONNECTION_STRING }}
container_name: cipp-api
source_folder: src/releases/
destination_folder: /
delete_if_exists: true
5 changes: 4 additions & 1 deletion Config/CyberEssentials.BPATemplate.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@
"isMFARegistered",
"defaultMFAMethod"
],
"URL": "https://graph.microsoft.com/beta/reports/authenticationMethods/userRegistrationDetails"
"URL": "https://graph.microsoft.com/beta/reports/authenticationMethods/userRegistrationDetails",
"Parameters": {
"asApp": "True"
}
}
]
}
23 changes: 23 additions & 0 deletions Config/cipp-roles.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"readonly": {
"include": ["*.Read"],
"exclude": ["CIPP.SuperAdmin.*"]
},
"editor": {
"include": ["*.Read", "*.ReadWrite"],
"exclude": [
"CIPP.SuperAdmin.*",
"CIPP.Admin.*",
"CIPP.AppSettings.*",
"Tenant.Standards.ReadWrite"
]
},
"admin": {
"include": ["*"],
"exclude": ["CIPP.SuperAdmin.*"]
},
"superadmin": {
"include": ["*"],
"exclude": []
}
}
16 changes: 16 additions & 0 deletions Config/schemaDefinitions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"id": "cippUser",
"description": "CIPP User Schema",
"targetTypes": ["User"],
"properties": [
{ "name": "jitAdminEnabled", "type": "Boolean" },
{ "name": "jitAdminExpiration", "type": "DateTime" },
{ "name": "mailboxType", "type": "String" },
{ "name": "archiveEnabled", "type": "Boolean" },
{ "name": "autoExpandingArchiveEnabled", "type": "Boolean" },
{ "name": "perUserMfaState", "type": "String" }
],
"status": "Available"
}
]
222 changes: 222 additions & 0 deletions ConversionTable.csv

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion Modules/CIPPCore/Public/Add-CIPPScheduledTask.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,15 @@ function Add-CIPPScheduledTask {
if ([int64]$task.ScheduledTime -eq 0 -or [string]::IsNullOrEmpty($task.ScheduledTime)) {
$task.ScheduledTime = [int64](([datetime]::UtcNow) - (Get-Date '1/1/1970')).TotalSeconds
}

$excludedTenants = if ($task.excludedTenants.value) {
$task.excludedTenants.value -join ','
}
$entity = @{
PartitionKey = [string]'ScheduledTask'
TaskState = [string]'Planned'
RowKey = [string]$RowKey
Tenant = $task.TenantFilter.value ? "$($task.TenantFilter.value)" : "$($task.TenantFilter)"
excludedTenants = [string]$excludedTenants
Name = [string]$task.Name
Command = [string]$task.Command.value
Parameters = [string]$Parameters
Expand Down
24 changes: 24 additions & 0 deletions Modules/CIPPCore/Public/Alerts/Get-CIPPAlertDefenderIncidents.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

function Get-CIPPAlertDefenderIncidents {
<#
.FUNCTIONALITY
Entrypoint
#>
[CmdletBinding()]
param(
[Parameter(Mandatory = $false)]
[Alias('input')]
$InputValue,
$TenantFilter
)
try {
$AlertData = New-GraphGetRequest -uri "https://graph.microsoft.com/v1.0/security/incidents?`$top=50&`$filter=status eq 'active'" -tenantid $TenantFilter | ForEach-Object {
"Incident ID $($_.id): Created at $($_.createdDateTime). Severity: $($_.severity). `nIncident name: $($_.displayName). Incident URL: $($_.incidentWebUrl)."
}
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData

} catch {
# Pretty sure this one is gonna be spammy cause of licensing issues, so it's commented out -Bobby
# Write-AlertMessage -tenant $($TenantFilter) -message "Could not get Defender incident data for $($TenantFilter): $(Get-NormalizedError -message $_.Exception.message)"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ function Get-CIPPAlertEntraLicenseUtilization {
$Alerts = [System.Collections.Generic.List[string]]::new()

# Check P1 License utilization
if ($LicenseData.entitledP1LicenseCount -gt 0) {
if ($LicenseData.entitledP1LicenseCount -gt 0 -or $LicenseData.entitledP2LicenseCount -gt 0) {
$P1Used = $LicenseData.p1FeatureUtilizations.conditionalAccess.userCount
$P1Entitled = $LicenseData.entitledP1LicenseCount
$P1Entitled = $LicenseData.entitledP1LicenseCount + $LicenseData.entitledP2LicenseCount
$P1Usage = ($P1Used / $P1Entitled) * 100
$P1Overage = $P1Used - $P1Entitled

Expand Down
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) | 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=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) | 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=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
4 changes: 1 addition & 3 deletions Modules/CIPPCore/Public/Alerts/Get-CIPPAlertNoCAConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@ function Get-CIPPAlertNoCAConfig {
)

try {
$CAAvailable = (New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/subscribedSkus' -tenantid $TenantFilter -erroraction stop).serviceplans
$CAAvailable = (New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/subscribedSkus' -tenantid $TenantFilter -ErrorAction Stop).serviceplans
if ('AAD_PREMIUM' -in $CAAvailable.servicePlanName) {
$CAPolicies = (New-GraphGetRequest -uri 'https://graph.microsoft.com/v1.0/identity/conditionalAccess/policies' -tenantid $TenantFilter)
if (!$CAPolicies.id) {
$AlertData = 'Conditional Access is available, but no policies could be found.'
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData

}
}

} catch {
Write-AlertMessage -tenant $($TenantFilter) -message "Conditional Access Config Alert: Error occurred: $(Get-NormalizedError -message $_.Exception.message)"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ function Get-CIPPAlertUnusedLicenses {
$TenantFilter
)


try {
$LicenseTable = Get-CIPPTable -TableName ExcludedLicenses
$ExcludedSkuList = Get-CIPPAzDataTableEntity @LicenseTable
$AlertData = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/subscribedSkus' -tenantid $TenantFilter | ForEach-Object {
$skuid = $_
foreach ($sku in $skuid) {
$skuId = $_
foreach ($sku in $skuId) {
if ($sku.skuId -in $ExcludedSkuList.GUID) { continue }
$PrettyName = ($ConvertTable | Where-Object { $_.GUID -eq $sku.skuid }).'Product_Display_Name' | Select-Object -Last 1
$PrettyName = ($ConvertTable | Where-Object { $_.GUID -eq $sku.skuId }).'Product_Display_Name' | Select-Object -Last 1
if (!$PrettyName) { $PrettyName = $sku.skuPartNumber }
if ($sku.prepaidUnits.enabled - $sku.consumedUnits -gt 0) {
"$PrettyName has unused licenses. Using $($_.consumedUnits) of $($_.prepaidUnits.enabled)."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function Get-CIPPHttpFunctions {
$Results = foreach ($Function in $Functions) {
$Help = Get-Help $Function
if ($Help.Functionality -ne 'Entrypoint') { continue }
if ($Help.Role -eq 'Public') { continue }
[PSCustomObject]@{
Function = $Function.Name
Role = $Help.Role
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function Get-CippApiClient {
if ($AppId) {
$Table.Filter = "RowKey eq '$AppId'"
}
$Apps = Get-CIPPAzDataTableEntity @Table
$Apps = Get-CIPPAzDataTableEntity @Table | Where-Object { ![string]::IsNullOrEmpty($_.RowKey) }
$Apps = foreach ($Client in $Apps) {
$Client = $Client | Select-Object -Property @{Name = 'ClientId'; Expression = { $_.RowKey } }, AppName, Role, IPRange, Enabled

Expand Down
16 changes: 12 additions & 4 deletions Modules/CIPPCore/Public/Authentication/New-CIPPAPIConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ function New-CIPPAPIConfig {
[string]$AppId
)

$Permissions = Get-GraphToken -tenantid $env:TenantID -scope 'https://graph.microsoft.com/.default' -AsApp $true -SkipCache $true -ReturnRefresh $true
$Token = Read-JwtAccessDetails -Token $Permissions.access_token
$Permissions = $Token.Roles | Where-Object { $_ -match 'Application.ReadWrite.All' -or $_ -match 'Directory.ReadWrite.All' }
if (!$Permissions -or $Permissions.Count -lt 2) {
Write-LogMessage -headers $Headers -API $APINAME -tenant 'None '-message 'Insufficient permissions to create API App' -Sev 'Error'
throw 'Insufficient permissions to create API App. This integration requires the following Application permissions in the partner tenant. Application.ReadWrite.All, Directory.ReadWrite.All'
}

try {
if ($AppId) {
$APIApp = New-GraphGetRequest -uri "https://graph.microsoft.com/v1.0/applications(appid='$($AppId)')" -NoAuthCheck $true
Expand Down Expand Up @@ -53,13 +61,13 @@ function New-CIPPAPIConfig {

if ($PSCmdlet.ShouldProcess($AppName, 'Create API App')) {
Write-Information 'Creating app'
$APIApp = New-GraphPOSTRequest -uri 'https://graph.microsoft.com/v1.0/applications' -NoAuthCheck $true -type POST -body $CreateBody
$APIApp = New-GraphPOSTRequest -uri 'https://graph.microsoft.com/v1.0/applications' -AsApp $true -NoAuthCheck $true -type POST -body $CreateBody
Write-Information 'Creating password'
$APIPassword = New-GraphPOSTRequest -uri "https://graph.microsoft.com/v1.0/applications/$($APIApp.id)/addPassword" -NoAuthCheck $true -type POST -body "{`"passwordCredential`":{`"displayName`":`"Generated by API Setup`"}}"
$APIPassword = New-GraphPOSTRequest -uri "https://graph.microsoft.com/v1.0/applications/$($APIApp.id)/addPassword" -AsApp $true -NoAuthCheck $true -type POST -body "{`"passwordCredential`":{`"displayName`":`"Generated by API Setup`"}}"
Write-Information 'Adding App URL'
$APIIdUrl = New-GraphPOSTRequest -uri "https://graph.microsoft.com/v1.0/applications/$($APIApp.id)" -NoAuthCheck $true -type PATCH -body "{`"identifierUris`":[`"api://$($APIApp.appId)`"]}"
$APIIdUrl = New-GraphPOSTRequest -uri "https://graph.microsoft.com/v1.0/applications/$($APIApp.id)" -AsApp $true -NoAuthCheck $true -type PATCH -body "{`"identifierUris`":[`"api://$($APIApp.appId)`"]}"
Write-Information 'Adding serviceprincipal'
$ServicePrincipal = New-GraphPOSTRequest -uri 'https://graph.microsoft.com/v1.0/serviceprincipals' -NoAuthCheck $true -type POST -body "{`"accountEnabled`":true,`"appId`":`"$($APIApp.appId)`",`"displayName`":`"$AppName`",`"tags`":[`"WindowsAzureActiveDirectoryIntegratedApp`",`"AppServiceIntegratedApp`"]}"
$ServicePrincipal = New-GraphPOSTRequest -uri 'https://graph.microsoft.com/v1.0/serviceprincipals' -AsApp $true -NoAuthCheck $true -type POST -body "{`"accountEnabled`":true,`"appId`":`"$($APIApp.appId)`",`"displayName`":`"$AppName`",`"tags`":[`"WindowsAzureActiveDirectoryIntegratedApp`",`"AppServiceIntegratedApp`"]}"
Write-LogMessage -headers $Headers -API $APINAME -tenant 'None '-message "Created CIPP-API App with name '$($APIApp.displayName)'." -Sev 'info'
}
}
Expand Down
6 changes: 4 additions & 2 deletions Modules/CIPPCore/Public/Authentication/Set-CippApiAuth.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function Set-CippApiAuth {
[CmdletBinding(SupportsShouldProcess)]
Param(
param(
[string]$RGName,
[string]$FunctionAppName,
[string]$TenantId,
Expand All @@ -9,7 +9,9 @@ function Set-CippApiAuth {

if ($env:MSI_SECRET) {
Disable-AzContextAutosave -Scope Process | Out-Null
$Context = (Connect-AzAccount -Identity).Context
$null = Connect-AzAccount -Identity
$SubscriptionId = $ENV:WEBSITE_OWNER_NAME -split '\+' | Select-Object -First 1
$Context = Set-AzContext -SubscriptionId $SubscriptionId
} else {
$Context = Get-AzContext
}
Expand Down
17 changes: 12 additions & 5 deletions Modules/CIPPCore/Public/Authentication/Test-CIPPAccess.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ function Test-CIPPAccess {
# Check help for role
$APIRole = $Help.Role

$AnyTenantAllowedFunctions = @('ListTenants', 'ListUserSettings', 'ListUserPhoto', 'GetCippAlerts', 'GetVersion')
if ($APIRole -eq 'Public') {
return $true
}

# Get default roles from config
$CIPPCoreModuleRoot = Get-Module -Name CIPPCore | Select-Object -ExpandProperty ModuleBase
$CIPPRoot = (Get-Item $CIPPCoreModuleRoot).Parent.Parent
$BaseRoles = Get-Content -Path $CIPPRoot\Config\cipp-roles.json | ConvertFrom-Json

if ($Request.Headers.'x-ms-client-principal-idp' -eq 'aad' -and $Request.Headers.'x-ms-client-principal-name' -match '^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$') {
# Direct API Access
Expand Down Expand Up @@ -108,7 +115,7 @@ function Test-CIPPAccess {
}

if ($APIAllowed) {
$TenantFilter = $Request.Query.tenantFilter ?? $Request.Body.tenantFilter ?? $env:TenantID
$TenantFilter = $Request.Query.tenantFilter ?? $Request.Body.tenantFilter ?? $Request.Query.tenantId ?? $Request.Body.tenantId ?? $env:TenantID
# Check tenant level access
if (($Role.BlockedTenants | Measure-Object).Count -eq 0 -and $Role.AllowedTenants -contains 'AllTenants') {
$TenantAllowed = $true
Expand All @@ -132,15 +139,15 @@ function Test-CIPPAccess {
}
}
}

if (!$APIAllowed) {
throw "Access to this CIPP API endpoint is not allowed, the '$($Role.Role)' custom role does not have the required permission: $APIRole"
throw "Access to this CIPP API endpoint is not allowed, you do not have the required permission: $APIRole"
}
if (!$TenantAllowed -and $AnyTenantAllowedFunctions -notcontains $Request.Params.CIPPEndpoint) {
if (!$TenantAllowed -and $Help.Functionality -notmatch 'AnyTenant') {
throw 'Access to this tenant is not allowed'
} else {
return $true
}

} else {
# No permissions found for any roles
if ($TenantList.IsPresent) {
Expand Down
20 changes: 11 additions & 9 deletions Modules/CIPPCore/Public/Clear-CippDurables.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ function Clear-CippDurables {
}
}

Remove-AzDataTable @InstancesTable
Remove-AzDataTable @HistoryTable
$BlobContainer = '{0}-largemessages' -f $FunctionName
if (Get-AzStorageContainer -Name $BlobContainer -Context $StorageContext -ErrorAction SilentlyContinue) {
Write-Information "- Removing blob container: $BlobContainer"
if ($PSCmdlet.ShouldProcess($BlobContainer, 'Remove Blob Container')) {
Remove-AzStorageContainer -Name $BlobContainer -Context $StorageContext -Confirm:$false -Force
}
}

$QueueTable = Get-CippTable -TableName 'CippQueue'
$CippQueue = Invoke-ListCippQueue
$QueueEntities = foreach ($Queue in $CippQueue) {
Expand All @@ -45,15 +55,7 @@ function Clear-CippDurables {
}
}

Remove-AzDataTable @InstancesTable
Remove-AzDataTable @HistoryTable
$BlobContainer = '{0}-largemessages' -f $FunctionName
if (Get-AzStorageContainer -Name $BlobContainer -Context $StorageContext -ErrorAction SilentlyContinue) {
Write-Information "- Removing blob container: $BlobContainer"
if ($PSCmdlet.ShouldProcess($BlobContainer, 'Remove Blob Container')) {
Remove-AzStorageContainer -Name $BlobContainer -Context $StorageContext -Confirm:$false -Force
}
}
$null = Get-CippTable -TableName ('{0}History' -f $FunctionName)
Write-Information 'Durable Orchestrators and Queues have been cleared'
return $true
}
Loading