Skip to content

Commit 83894e1

Browse files
Merge branch 'KelvinTegelaar:master' into master
2 parents 12563a6 + 56eb9fc commit 83894e1

File tree

52 files changed

+644
-282
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+644
-282
lines changed

Activity_AddOrUpdateTableRows/run.ps1

+6-7
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ $TableName = ($TableParams.Context['TableName'])
33
$Table = Get-CippTable -tablename $TableName
44

55
foreach ($param in $TableParams.Entity) {
6-
try {
7-
#Sending each item indivually, if it fails, log an error.
8-
Add-CIPPAzDataTableEntity @Table -Entity $param -Force
9-
}
10-
catch {
11-
Write-LogMessage -API 'Activity_AddOrUpdateTableRows' -message "Unable to write to '$($TableParams.TableName)' Using RowKey $($param.RowKey) table: $($_.Exception.Message)" -sev error
12-
}
6+
try {
7+
#Sending each item indivually, if it fails, log an error.
8+
Add-CIPPAzDataTableEntity @Table -Entity $param -Force
9+
} catch {
10+
Write-LogMessage -API 'Activity_AddOrUpdateTableRows' -message "Unable to write to '$($TableParams.TableName)' Using RowKey $($param.RowKey)" -LogData (Get-CippException -Exception $_) -sev error
11+
}
1312
}

Applications_Orchestrator/run.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ try {
1717
$Outputs = Wait-ActivityFunction -Task $ParallelTasks
1818
Write-Host $Outputs
1919
}
20-
catch {
20+
catch {
2121
Write-Host "Applications_Orchestrator exception: $($_.Exception.Message)"
2222
}
2323
finally {

Applications_Upload/run.ps1

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
param($name)
22
$Table = Get-CippTable -tablename 'apps'
3-
$Filter = "PartitionKey eq 'apps' and RowKey eq '$name'"
3+
$Filter = "PartitionKey eq 'apps' and RowKey eq '$name'"
44
Set-Location (Get-Item $PSScriptRoot).Parent.FullName
55
$ChocoApp = (Get-CIPPAzDataTableEntity @Table -filter $Filter).JSON | ConvertFrom-Json
66
$intuneBody = $ChocoApp.IntuneBody
7-
$tenants = if ($chocoapp.Tenant -eq 'AllTenants') {
7+
$tenants = if ($chocoapp.Tenant -eq 'AllTenants') {
88
(Get-tenants).defaultDomainName
99
} else {
1010
$chocoapp.Tenant
11-
}
11+
}
1212
if ($chocoApp.type -eq 'MSPApp') {
1313
[xml]$Intunexml = Get-Content "AddMSPApp\$($ChocoApp.MSPAppName).app.xml"
1414
$intunewinFilesize = (Get-Item "AddMSPApp\$($ChocoApp.MSPAppName).intunewin")
@@ -25,7 +25,7 @@ $ContentBody = ConvertTo-Json @{
2525
name = $intunexml.ApplicationInfo.FileName
2626
size = [int64]$intunexml.ApplicationInfo.UnencryptedContentSize
2727
sizeEncrypted = [int64]($intunewinFilesize).length
28-
}
28+
}
2929
$ClearRow = Get-CIPPAzDataTableEntity @Table -Filter $Filter
3030
$RemoveCacheFile = if ($chocoapp.Tenant -ne 'AllTenants') {
3131
Remove-AzDataTableEntity @Table -Entity $clearRow
@@ -54,11 +54,11 @@ foreach ($tenant in $tenants) {
5454
Try {
5555

5656
$ApplicationList = (New-graphGetRequest -Uri $baseuri -tenantid $Tenant) | Where-Object { $_.DisplayName -eq $ChocoApp.ApplicationName }
57-
if ($ApplicationList.displayname.count -ge 1) {
57+
if ($ApplicationList.displayname.count -ge 1) {
5858
Write-LogMessage -api 'AppUpload' -tenant $($Tenant) -message "$($ChocoApp.ApplicationName) exists. Skipping this application" -Sev 'Info'
5959
continue
6060
}
61-
if ($chocoApp.type -eq 'WinGet') {
61+
if ($chocoApp.type -eq 'WinGet') {
6262
Write-Host 'Winget!'
6363
Write-Host ($intuneBody | ConvertTo-Json -Compress)
6464
$NewApp = New-GraphPostRequest -Uri $baseuri -Body ($intuneBody | ConvertTo-Json -Compress) -Type POST -tenantid $tenant
@@ -79,8 +79,8 @@ foreach ($tenant in $tenants) {
7979
$AzFileUri = New-graphGetRequest -Uri "$($BaseURI)/$($NewApp.id)/microsoft.graph.win32lobapp/contentVersions/1/files/$($ContentReq.id)" -tenantid $tenant
8080
if ($AZfileuri.uploadState -like '*fail*') { break }
8181
Start-Sleep -Milliseconds 300
82-
} while ($AzFileUri.AzureStorageUri -eq $null)
83-
82+
} while ($AzFileUri.AzureStorageUri -eq $null)
83+
8484
$chunkSizeInBytes = 4mb
8585
[byte[]]$bytes = [System.IO.File]::ReadAllBytes($($intunewinFilesize.fullname))
8686
$chunks = [Math]::Ceiling($bytes.Length / $chunkSizeInBytes)
@@ -89,15 +89,15 @@ foreach ($tenant in $tenants) {
8989
$Upload = Invoke-RestMethod -Uri "$($AzFileUri.azureStorageUri)&comp=block&blockid=$id" -Method Put -Headers @{'x-ms-blob-type' = 'BlockBlob' } -InFile $inFile -ContentType 'application/octet-stream'
9090
$ConfirmUpload = Invoke-RestMethod -Uri "$($AzFileUri.azureStorageUri)&comp=blocklist" -Method Put -Body "<?xml version=`"1.0`" encoding=`"utf-8`"?><BlockList><Latest>$id</Latest></BlockList>"
9191
$CommitReq = New-graphPostRequest -Uri "$($BaseURI)/$($NewApp.id)/microsoft.graph.win32lobapp/contentVersions/1/files/$($ContentReq.id)/commit" -Body $EncBody -Type POST -tenantid $tenant
92-
92+
9393
do {
9494
$CommitStateReq = New-graphGetRequest -Uri "$($BaseURI)/$($NewApp.id)/microsoft.graph.win32lobapp/contentVersions/1/files/$($ContentReq.id)" -tenantid $tenant
9595
if ($CommitStateReq.uploadState -like '*fail*') {
9696
Write-LogMessage -api 'AppUpload' -tenant $($Tenant) -message "$($ChocoApp.ApplicationName) Commit failed. Please check if app uploaded succesful" -Sev 'Warning'
97-
break
97+
break
9898
}
9999
Start-Sleep -Milliseconds 300
100-
} while ($CommitStateReq.uploadState -eq 'commitFilePending')
100+
} while ($CommitStateReq.uploadState -eq 'commitFilePending')
101101
$CommitFinalizeReq = New-graphPostRequest -Uri "$($BaseURI)/$($NewApp.id)" -tenantid $tenant -Body '{"@odata.type":"#microsoft.graph.win32lobapp","committedContentVersion":"1"}' -type PATCH
102102
Write-LogMessage -api 'AppUpload' -tenant $($Tenant) -message "Added Application $($chocoApp.ApplicationName)" -Sev 'Info'
103103
if ($AssignTo -ne 'On') {
@@ -108,7 +108,7 @@ foreach ($tenant in $tenants) {
108108
Write-LogMessage -api 'AppUpload' -tenant $($Tenant) -message 'Successfully added Application' -Sev 'Info'
109109
} catch {
110110
"Failed to add Application for $($Tenant): $($_.Exception.Message)"
111-
Write-LogMessage -api 'AppUpload' -tenant $($Tenant) -message "Failed adding Application $($ChocoApp.ApplicationName). Error: $($_.Exception.Message)" -Sev 'Error'
111+
Write-LogMessage -api 'AppUpload' -tenant $($Tenant) -message "Failed adding Application $($ChocoApp.ApplicationName). Error: $($_.Exception.Message)" -LogData (Get-CippException -Exception $_) -Sev 'Error'
112112
continue
113113
}
114114

BestPracticeAnalyser_All/run.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ $AddRow = foreach ($Template in $templates) {
107107
try {
108108
Add-CIPPAzDataTableEntity @Table -Entity $Result -Force
109109
} catch {
110-
Write-LogMessage -API 'BPA' -tenant $tenant -message "Error getting saving data for $($template.Name) - $($TenantName.customerId). Error: $($_.Exception.Message)" -sev Error
110+
Write-LogMessage -API 'BPA' -tenant $tenant -message "Error getting saving data for $($template.Name) - $($TenantName.customerId). Error: $($_.Exception.Message)" -LogData (Get-CippException -Exception $_) -sev Error
111111

112112
}
113113
}

DomainAnalyser_All/run.ps1

+9-8
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ try {
3636

3737
$Result = [PSCustomObject]@{
3838
Tenant = $Tenant.Tenant
39+
TenantID = $Tenant.TenantGUID
3940
GUID = $($Domain.Replace('.', ''))
4041
LastRefresh = $(Get-Date (Get-Date).ToUniversalTime() -UFormat '+%Y-%m-%dT%H:%M:%S.000Z')
4142
Domain = $Domain
@@ -116,8 +117,8 @@ try {
116117
$ScoreExplanation.Add('No SPF Record Found') | Out-Null
117118
}
118119
} catch {
119-
$Message = 'SPF Exception: {0} line {1} - {2}' -f $_.InvocationInfo.ScriptName, $_.InvocationInfo.ScriptLineNumber, $_.Exception.Message
120-
Write-LogMessage -API 'DomainAnalyser' -tenant $tenant.tenant -message $Message -sev Error
120+
$Message = 'SPF Error'
121+
Write-LogMessage -API 'DomainAnalyser' -tenant $tenant.tenant -message $Message -LogData (Get-CippException -Exception $_) -sev Error
121122
throw $Message
122123
}
123124

@@ -179,8 +180,8 @@ try {
179180
}
180181
}
181182
} catch {
182-
$Message = 'DMARC Exception: {0} line {1} - {2}' -f $_.InvocationInfo.ScriptName, $_.InvocationInfo.ScriptLineNumber, $_.Exception.Message
183-
Write-LogMessage -API 'DomainAnalyser' -tenant $tenant.tenant -message $Message -sev Error
183+
$Message = 'DMARC Error'
184+
Write-LogMessage -API 'DomainAnalyser' -tenant $tenant.tenant -message $Message -LogData (Get-CippException -Exception $_) -sev Error
184185
throw $Message
185186
}
186187

@@ -197,8 +198,8 @@ try {
197198
$ScoreExplanation.Add('DNSSEC Not Configured or Enabled') | Out-Null
198199
}
199200
} catch {
200-
$Message = 'DNSSEC Exception: {0} line {1} - {2}' -f $_.InvocationInfo.ScriptName, $_.InvocationInfo.ScriptLineNumber, $_.Exception.Message
201-
Write-LogMessage -API 'DomainAnalyser' -tenant $tenant.tenant -message $Message -sev Error
201+
$Message = 'DNSSEC Error'
202+
Write-LogMessage -API 'DomainAnalyser' -tenant $tenant.tenant -message $Message -LogData (Get-CippException -Exception $_) -sev Error
202203
throw $Message
203204
}
204205

@@ -226,8 +227,8 @@ try {
226227
$ScoreExplanation.Add('DKIM Not Configured') | Out-Null
227228
}
228229
} catch {
229-
$Message = 'DKIM Exception: {0} line {1} - {2}' -f $_.InvocationInfo.ScriptName, $_.InvocationInfo.ScriptLineNumber, $_.Exception.Message
230-
Write-LogMessage -API 'DomainAnalyser' -tenant $tenant.tenant -message $Message -sev Error
230+
$Message = 'DKIM Exception'
231+
Write-LogMessage -API 'DomainAnalyser' -tenant $tenant.tenant -message $Message -LogData (Get-CippException -Exception $_) -sev Error
231232
throw $Message
232233
}
233234
# Final Score

DomainAnalyser_GetTenantDomains/run.ps1

+9-5
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ $TenantDomains = $Tenants | ForEach-Object -Parallel {
99
$Tenant = $_
1010
# Get Domains to Lookup
1111
try {
12-
$Domains = New-GraphGetRequest -uri 'https://graph.microsoft.com/v1.0/domains' -tenantid $Tenant.defaultDomainName | Where-Object { ($_.id -notlike '*.microsoftonline.com' -and $_.id -NotLike '*.exclaimer.cloud' -and $_.id -NotLike '*.codetwo.online' -and $_.id -NotLike '*.call2teams.com' -and $_.isVerified) }
12+
$Domains = New-GraphGetRequest -uri 'https://graph.microsoft.com/v1.0/domains' -tenantid $Tenant.defaultDomainName | Where-Object { ($_.id -notlike '*.microsoftonline.com' -and $_.id -NotLike '*.exclaimer.cloud' -and $_.id -Notlike '*.excl.cloud' -and $_.id -NotLike '*.codetwo.online' -and $_.id -NotLike '*.call2teams.com' -and $_.isVerified) }
13+
1314
foreach ($d in $domains) {
1415
[PSCustomObject]@{
1516
Tenant = $Tenant.defaultDomainName
17+
TenantGUID = $Tenant.customerId
18+
InitialDomainName = $Tenant.initialDomainName
1619
Domain = $d.id
1720
AuthenticationType = $d.authenticationType
1821
IsAdminManaged = $d.isAdminManaged
@@ -24,7 +27,7 @@ $TenantDomains = $Tenants | ForEach-Object -Parallel {
2427
}
2528
}
2629
} catch {
27-
Write-LogMessage -API 'DomainAnalyser' -tenant $tenant.defaultDomainName -message "DNS Analyser GraphGetRequest Exception: $($_.Exception.Message)" -sev Error
30+
Write-LogMessage -API 'DomainAnalyser' -tenant $tenant.defaultDomainName -message 'DNS Analyser GraphGetRequest' -LogData (Get-CippException -Exception $_) -sev Error
2831
}
2932
} | Sort-Object -Unique -Property Domain
3033

@@ -57,11 +60,12 @@ if ($TenantCount -gt 0) {
5760
$Filter = "PartitionKey eq 'TenantDomains' and RowKey eq '{0}'" -f $Tenant.Domain
5861
$Domain = Get-CIPPAzDataTableEntity @DomainTable -Filter $Filter
5962

60-
if (!$Domain) {
63+
if (!$Domain -or $null -eq $Domain.TenantGUID) {
6164
$DomainObject = [pscustomobject]@{
6265
DomainAnalyser = ''
6366
TenantDetails = $TenantDetails
6467
TenantId = $Tenant.Tenant
68+
TenantGUID = $Tenant.TenantGUID
6569
DkimSelectors = ''
6670
MailProviders = ''
6771
RowKey = $Tenant.Domain
@@ -87,6 +91,6 @@ if ($TenantCount -gt 0) {
8791
# Batch insert all tenant domains
8892
try {
8993
Add-CIPPAzDataTableEntity @DomainTable -Entity $TenantDomainObjects -Force
90-
} catch { Write-LogMessage -API 'DomainAnalyser' -message "Domain Analyser GetTenantDomains Error $($_.Exception.Message)" -sev info }
91-
} catch { Write-LogMessage -API 'DomainAnalyser' -message "GetTenantDomains loop exception: $($_.Exception.Message) line $($_.InvocationInfo.ScriptLineNumber)" -sev 'Error' }
94+
} catch { Write-LogMessage -API 'DomainAnalyser' -message 'Domain Analyser GetTenantDomains error' -sev info -LogData (Get-CippException -Exception $_) }
95+
} catch { Write-LogMessage -API 'DomainAnalyser' -message 'GetTenantDomains loop error' -sev 'Error' -LogData (Get-CippException -Exception $_) }
9296
}

DomainAnalyser_Orchestration/run.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ try {
3333
Write-Host "Orchestrator exception UpdateDomains $($_.Exception.Message)"
3434
}
3535
} catch {
36-
Write-LogMessage -API 'DomainAnalyser' -message "Domain Analyser Orchestrator Error $($_.Exception.Message)" -sev info
36+
Write-LogMessage -API 'DomainAnalyser' -message 'Domain Analyser Orchestrator Error' -sev info -LogData (Get-CippException -Exception $_)
3737
#Write-Host $_.Exception | ConvertTo-Json
3838
} finally {
3939
Write-LogMessage -API 'DomainAnalyser' -message 'Domain Analyser has Finished' -sev Info

ExecSchedulerBillingRun/run.ps1

+4-5
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,19 @@ param($QueueItem)
33

44
# Get the current universal time in the default string format.
55
try {
6-
Write-LogMessage -API "Scheduler_Billing" -tenant "none" -message "Starting billing processing." -sev Info
6+
Write-LogMessage -API 'Scheduler_Billing' -tenant 'none' -message 'Starting billing processing.' -sev Info
77

88
$Table = Get-CIPPTable -TableName Extensionsconfig
99
$Configuration = (Get-CIPPAzDataTableEntity @Table).config | ConvertFrom-Json -Depth 10
1010
foreach ($ConfigItem in $Configuration.psobject.properties.name) {
1111
switch ($ConfigItem) {
12-
"Gradient" {
12+
'Gradient' {
1313
If ($Configuration.Gradient.enabled -and $Configuration.Gradient.BillingEnabled) {
1414
New-GradientServiceSyncRun
1515
}
1616
}
1717
}
1818
}
19-
}
20-
catch {
21-
Write-LogMessage -API "Scheduler_Billing" -tenant "none" -message "Could not start billing processing $($_.Exception.Message)" -sev Error
19+
} catch {
20+
Write-LogMessage -API 'Scheduler_Billing' -tenant 'none' -message 'Could not start billing processing' -sev Error -LogData (Get-CippException -Exception $_)
2221
}

Modules/CIPPCore/Public/Add-CIPPAzDataTableEntity.ps1

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function Add-CIPPAzDataTableEntity {
99

1010
foreach ($SingleEnt in $Entity) {
1111
try {
12-
Add-AzDataTableEntity -context $Context -force:$Force -CreateTableIfNotExists:$CreateTableIfNotExists -Entity $SingleEnt
12+
Add-AzDataTableEntity -context $Context -force:$Force -CreateTableIfNotExists:$CreateTableIfNotExists -Entity $SingleEnt -ErrorAction Stop
1313
} catch [System.Exception] {
1414
if ($_.Exception.ErrorCode -eq 'PropertyValueTooLarge' -or $_.Exception.ErrorCode -eq 'EntityTooLarge') {
1515
try {
@@ -52,6 +52,8 @@ function Add-CIPPAzDataTableEntity {
5252
throw "Error processing entity: $($_.Exception.Message)."
5353
}
5454
} else {
55+
Write-Host "THE ERROR IS $($_.Exception.ErrorCode)"
56+
5557
throw $_
5658
}
5759
}
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
function Add-CIPPGroupMember(
22
[string]$ExecutingUser,
3-
[string]$GroupType,
3+
[string]$GroupType,
44
[string]$GroupId,
5-
[string]$Member,
5+
[string]$Member,
66
[string]$TenantFilter,
77
[string]$APIName = 'Add Group Member'
88
) {
99
try {
1010
if ($member -like '*#EXT#*') { $member = [System.Web.HttpUtility]::UrlEncode($member) }
11-
$MemberIDs = 'https://graph.microsoft.com/v1.0/directoryObjects/' + (New-GraphGetRequest -uri "https://graph.microsoft.com/beta/users/$($member)" -tenantid $TenantFilter).id
11+
$MemberIDs = 'https://graph.microsoft.com/v1.0/directoryObjects/' + (New-GraphGetRequest -uri "https://graph.microsoft.com/beta/users/$($member)" -tenantid $TenantFilter).id
1212
$addmemberbody = "{ `"members@odata.bind`": $(ConvertTo-Json @($MemberIDs)) }"
1313
if ($GroupType -eq 'Distribution list' -or $GroupType -eq 'Mail-Enabled Security') {
1414
$Params = @{ Identity = $GroupId; Member = $member; BypassSecurityGroupManagerCheck = $true }
15-
New-ExoRequest -tenantid $TenantFilter -cmdlet 'Add-DistributionGroupMember' -cmdParams $params -UseSystemMailbox $true
15+
New-ExoRequest -tenantid $TenantFilter -cmdlet 'Add-DistributionGroupMember' -cmdParams $params -UseSystemMailbox $true
1616
} else {
1717
New-GraphPostRequest -uri "https://graph.microsoft.com/beta/groups/$($GroupId)" -tenantid $TenantFilter -type patch -body $addmemberbody -Verbose
1818
}
@@ -21,9 +21,9 @@ function Add-CIPPGroupMember(
2121
return $message
2222
return
2323
} catch {
24-
$message = "Failed to add user $($Member) to $($GroupId): $($_.Exception.Message)"
25-
Write-LogMessage -user $ExecutingUser -API $APIName -tenant $TenantFilter -message $message -Sev 'error'
26-
return $message
24+
$message = "Failed to add user $($Member) to $($GroupId)"
25+
Write-LogMessage -user $ExecutingUser -API $APIName -tenant $TenantFilter -message $message -Sev 'error' -LogData (Get-CippException -Exception $_)
26+
return $message
2727
}
2828

2929
}

Modules/CIPPCore/Public/Add-CIPPScheduledTask.ps1

+10-7
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ function Add-CIPPScheduledTask {
1818
$ht[$p.Key] = $p.Value
1919
}
2020
$Parameters[$Key] = [PSCustomObject]$ht
21-
}
22-
else {
21+
} else {
2322
$Parameters[$Key] = $Param
2423
}
2524
}
@@ -30,10 +29,15 @@ function Add-CIPPScheduledTask {
3029
}
3130
$AdditionalProperties = ([PSCustomObject]$AdditionalProperties | ConvertTo-Json -Compress)
3231
if ($Parameters -eq 'null') { $Parameters = '' }
32+
if (!$Task.RowKey) {
33+
$RowKey = (New-Guid).Guid
34+
} else {
35+
$RowKey = $Task.RowKey
36+
}
3337
$entity = @{
3438
PartitionKey = [string]'ScheduledTask'
3539
TaskState = [string]'Planned'
36-
RowKey = [string]"$(New-Guid)"
40+
RowKey = [string]$RowKey
3741
Tenant = [string]$task.TenantFilter
3842
Name = [string]$task.Name
3943
Command = [string]$task.Command.value
@@ -46,10 +50,9 @@ function Add-CIPPScheduledTask {
4650
Results = 'Planned'
4751
}
4852
try {
49-
Add-CIPPAzDataTableEntity @Table -Entity $entity
50-
}
51-
catch {
53+
Add-CIPPAzDataTableEntity @Table -Entity $entity -Force
54+
} catch {
5255
return "Could not add task: $($_.Exception.Message)"
5356
}
54-
return "Successfully added task"
57+
return 'Successfully added task'
5558
}

Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Push-CIPPAlertMFAAlertUsers.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function Push-CIPPAlertMFAAlertUsers {
66
)
77
try {
88

9-
$users = New-GraphGETRequest -uri 'https://graph.microsoft.com/beta/reports/authenticationMethods/userRegistrationDetails?$filter=isMfaRegistered eq false and userType eq ''member''&$select=userPrincipalName,lastUpdatedDateTime,isMfaRegistered' -tenantid $($Item.tenant)
9+
$users = New-GraphGETRequest -uri 'https://graph.microsoft.com/beta/reports/authenticationMethods/userRegistrationDetails?$top=999&filter=isMfaRegistered eq false and userType eq ''member''&$select=userPrincipalName,lastUpdatedDateTime,isMfaRegistered' -tenantid $($Item.tenant)
1010
if ($users.UserPrincipalName) {
1111
Write-AlertMessage -tenant $Item.tenant -message "The following $($users.Count) users do not have MFA registered: $($users.UserPrincipalName -join ', ')"
1212
}

Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Push-CIPPAlertNewAppApproval.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function Push-CIPPAlertNewAppApproval {
66
[pscustomobject]$Item
77
)
88
try {
9-
$Approvals = New-GraphGetRequest -Uri 'https://graph.microsoft.com/beta/identityGovernance/appConsent/appConsentRequests' -tenantid $item.tenant
9+
$Approvals = New-GraphGetRequest -Uri 'https://graph.microsoft.com/beta/identityGovernance/appConsent/appConsentRequests' -tenantid $item.tenant | Where-Object -Property requestStatus -EQ 'inProgress'
1010
if ($Approvals.count -gt 1) {
1111
Write-AlertMessage -tenant $($Item.tenant) -message "There is are $($Approvals.count) App Approvals waiting."
1212
}

0 commit comments

Comments
 (0)