Skip to content

Commit acc8aed

Browse files
Merge pull request KelvinTegelaar#1400 from kris6673/fix-app-approval
fix:: Refactor NewAppApproval alert message
2 parents 60a2a7b + 15689dd commit acc8aed

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function Get-CIPPAlertNewAppApproval {
1515
try {
1616
$Approvals = New-GraphGetRequest -Uri "https://graph.microsoft.com/beta/identityGovernance/appConsent/appConsentRequests?`$filter=userConsentRequests/any (u:u/status eq 'InProgress')" -tenantid $TenantFilter
1717
if ($Approvals.count -gt 0) {
18-
$AlertData = [System.Collections.Generic.List[string]]::new()
18+
$AlertData = [System.Collections.Generic.List[PSCustomObject]]::new()
1919
foreach ($App in $Approvals) {
2020
$userConsentRequests = New-GraphGetRequest -Uri "https://graph.microsoft.com/v1.0/identityGovernance/appConsent/appConsentRequests/$($App.id)/userConsentRequests" -tenantid $TenantFilter
2121
$userConsentRequests | ForEach-Object {
@@ -28,7 +28,15 @@ function Get-CIPPAlertNewAppApproval {
2828
"https://login.microsoftonline.com/$($TenantFilter)/adminConsent?client_id=$($App.appId)&bf_id=$($App.id)&redirect_uri=https://entra.microsoft.com/TokenAuthorize"
2929
}
3030

31-
$Message = "App name: $($App.appDisplayName) - Request user: $($_.createdBy.user.userPrincipalName) - Reason: $($_.reason)`nApp Id: $($App.appId) - Scopes: $($App.pendingScopes.displayName)`nConsent URL: $consentUrl"
31+
$Message = [PSCustomObject]@{
32+
AppName = $App.appDisplayName
33+
RequestUser = $_.createdBy.user.userPrincipalName
34+
Reason = $_.reason
35+
AppId = $App.appId
36+
Scopes = ($App.pendingScopes.displayName -join ', ')
37+
ConsentURL = $consentUrl
38+
Tenant = $TenantFilter
39+
}
3240
$AlertData.Add($Message)
3341
}
3442
}

0 commit comments

Comments
 (0)