Skip to content

Commit d0752dc

Browse files
committed
Fix serviceprincipal output
1 parent e86b268 commit d0752dc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecServicePrincipals.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ function Invoke-ExecServicePrincipals {
2222
'appId' = $Request.Query.AppId
2323
} | ConvertTo-Json -Compress
2424
try {
25-
$Results = New-GraphPostRequest -Uri 'https://graph.microsoft.com/beta/servicePrincipals' -tenantid $TenantFilter -type POST -body $Body -NoAuthCheck $true
25+
$ServicePrincipal = New-GraphPostRequest -Uri 'https://graph.microsoft.com/beta/servicePrincipals' -tenantid $TenantFilter -type POST -body $Body -NoAuthCheck $true
26+
$Results = "Created service principal for $($ServicePrincipal.displayName) ($($ServicePrincipal.appId))"
2627
} catch {
2728
$Results = "Unable to create service principal: $($_.Exception.Message)"
2829
$Success = $false
@@ -55,6 +56,10 @@ function Invoke-ExecServicePrincipals {
5556
'Success' = $Success
5657
}
5758

59+
if ($ServicePrincipal) {
60+
$Metadata.ServicePrincipal = $ServicePrincipal
61+
}
62+
5863
if ($Request.Query.AppId) {
5964
$Metadata.AppId = $Request.Query.AppId
6065
}

0 commit comments

Comments
 (0)