Skip to content

Commit c464bb1

Browse files
committed
switch to app permissions
1 parent 63e559d commit c464bb1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 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

0 commit comments

Comments
 (0)