Skip to content

Commit c6199de

Browse files
authored
Merge pull request #165 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents 472c74a + 4b7e00c commit c6199de

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Identity/Administration/Users/Invoke-ExecSendPush.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using namespace System.Net
22

3-
Function Invoke-ExecSendPush {
3+
function Invoke-ExecSendPush {
44
<#
55
.FUNCTIONALITY
66
Entrypoint
@@ -33,15 +33,15 @@ Function Invoke-ExecSendPush {
3333
Start-Sleep 1
3434
$ClientToken = Get-ClientAccess -uri $uri -body $body -count $count
3535
} else {
36-
Throw "Could not get Client Token: $_"
36+
throw "Could not get Client Token: $_"
3737
}
3838
}
3939
return $ClientToken
4040
}
4141

4242

4343
# Get all service principals
44-
$SPResult = New-GraphGetRequest -uri "https://graph.microsoft.com/beta/servicePrincipals?`$top=999&`$select=id,appId" -tenantid $TenantFilter
44+
$SPResult = New-GraphGetRequest -uri "https://graph.microsoft.com/beta/servicePrincipals?`$top=999&`$select=id,appId" -tenantid $TenantFilter -AsApp $true
4545

4646
# Check if we have one for the MFA App
4747
$SPID = ($SPResult | Where-Object { $_.appId -eq $MFAAppID }).id
@@ -52,7 +52,7 @@ Function Invoke-ExecSendPush {
5252
$SPBody = [pscustomobject]@{
5353
appId = $MFAAppID
5454
}
55-
$SPID = (New-GraphPostRequest -uri 'https://graph.microsoft.com/v1.0/servicePrincipals' -tenantid $TenantFilter -type POST -body $SPBody ).id
55+
$SPID = (New-GraphPostRequest -uri 'https://graph.microsoft.com/v1.0/servicePrincipals' -tenantid $TenantFilter -type POST -body $SPBody -AsApp $true).id
5656
}
5757

5858

@@ -104,16 +104,16 @@ Function Invoke-ExecSendPush {
104104

105105
if ($obj.BeginTwoWayAuthenticationResponse.result) {
106106
$Body = "Received an MFA confirmation: $($obj.BeginTwoWayAuthenticationResponse.result.value | Out-String)"
107-
$colour = 'success'
107+
$State = 'success'
108108
}
109109
if ($obj.BeginTwoWayAuthenticationResponse.AuthenticationResult -ne $true) {
110110
$Body = "Authentication Failed! Does the user have Push/Phone call MFA configured? ErrorCode: $($obj.BeginTwoWayAuthenticationResponse.result.value | Out-String)"
111-
$colour = 'error'
111+
$State = 'error'
112112
}
113113

114114
}
115115

116-
$Results = [pscustomobject]@{'Results' = $Body; severity = $colour }
116+
$Results = [pscustomobject]@{'Results' = @{ resultText = $Body; state = $State } }
117117
Write-LogMessage -headers $Request.Headers -API $APINAME -message "Sent push request to $UserEmail - Result: $($obj.BeginTwoWayAuthenticationResponse.result.value | Out-String)" -Sev 'Info'
118118

119119
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{

0 commit comments

Comments
 (0)