Skip to content

Commit

Permalink
api client tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnDuprey committed Feb 5, 2025
1 parent 4a7db7e commit ad2f2f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Modules/CIPPCore/Public/Authentication/New-CIPPAPIConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function New-CIPPAPIConfig {

$BatchResponse = New-GraphBulkRequest -tenantid $env:TenantID -NoAuthCheck $true -asapp $true -Requests $Requests
$APIPassword = $BatchResponse | Where-Object { $_.id -eq 'addPassword' } | Select-Object -ExpandProperty body
Write-LogMessage -user $ExecutingUser -API $APINAME -tenant 'None '-message "Created CIPP API App for $($APIApp.displayName)." -Sev 'info'
Write-LogMessage -user $ExecutingUser -API $APINAME -tenant 'None '-message "Created CIPP-API App with name '$($APIApp.displayName)'." -Sev 'info'
}
}
if ($ResetSecret.IsPresent -and $APIApp) {
Expand Down Expand Up @@ -133,13 +133,13 @@ function New-CIPPAPIConfig {
)
$BatchResponse = New-GraphBulkRequest -tenantid $env:TenantID -NoAuthCheck $true -asapp $true -Requests $Requests
$APIPassword = $BatchResponse | Where-Object { $_.id -eq 'addNewPassword' } | Select-Object -ExpandProperty body
Write-LogMessage -user $ExecutingUser -API $APINAME -tenant 'None '-message "Reset CIPP API Password for $($APIApp.displayName)." -Sev 'info'
Write-LogMessage -user $ExecutingUser -API $APINAME -tenant 'None '-message "Reset CIPP-API Password for '$($APIApp.displayName)'." -Sev 'info'
}
}

return @{
AppName = $APIApp.displayName
ApplicationID = $APIApp.AppId
ApplicationID = $APIApp.appId
ApplicationSecret = $APIPassword.secretText
Results = $Results
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ function Invoke-ExecApiClient {
$ApiConfig.AppName = $Request.Body.AppName
}
$APIConfig = New-CIPPAPIConfig @ApiConfig
$ClientId = $APIConfig.AppId
$AddedText = $APIConfig.Results
} catch {
$AddedText = 'Could not modify App Registrations. Check the CIPP documentation for API requirements.'
Expand Down

0 comments on commit ad2f2f6

Please sign in to comment.