Skip to content

Commit 074a969

Browse files
committed
fix: limit to just applicationid on self app lookup
1 parent 29a7044 commit 074a969

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

Modules/CIPPCore/Public/Add-CIPPDelegatedPermission.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ function Add-CIPPDelegatedPermission {
8282

8383
$ourSVCPrincipal = $ServicePrincipalList | Where-Object -Property AppId -EQ $ApplicationId | Select-Object -First 1
8484
if (!$ourSVCPrincipal) {
85-
$ServicePrincipalList = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/servicePrincipals?`$select=appId,id,displayName&`$top=999" -tenantid $TenantFilter -skipTokenCache $true -NoAuthCheck $true
86-
$ourSVCPrincipal = $ServicePrincipalList | Where-Object -Property AppId -EQ $ApplicationId | Select-Object -First 1
85+
$ourSvcPrincipal = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/servicePrincipals(appId='$ApplicationId')?`$select=appId,id,displayName" -tenantid $TenantFilter -skipTokenCache $true -NoAuthCheck $true
8786
}
8887
if (!$ourSVCPrincipal) {
8988
$Results.Add("Failed to find service principal for application $ApplicationId in tenant $TenantFilter")

0 commit comments

Comments
 (0)