Skip to content

Commit 14161cf

Browse files
committed
fix env casing and api errors
1 parent 4c6f9fb commit 14161cf

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

Modules/CIPPCore/Public/Authentication/New-CIPPAPIConfig.ps1

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,13 @@ function New-CIPPAPIConfig {
5555
enableAccessTokenIssuance = $false
5656
enableIdTokenIssuance = $true
5757
}
58-
redirectUris = @("https://$($ENV:Website_hostname)/.auth/login/aad/callback")
58+
redirectUris = @("https://$($ENV:WEBSITE_HOSTNAME)/.auth/login/aad/callback")
5959
}
6060
} | ConvertTo-Json -Depth 10 -Compress
6161

6262
if ($PSCmdlet.ShouldProcess($AppName, 'Create API App')) {
6363
Write-Information 'Creating app'
64+
Write-Information $CreateBody
6465
$APIApp = New-GraphPOSTRequest -uri 'https://graph.microsoft.com/v1.0/applications' -AsApp $true -NoAuthCheck $true -type POST -body $CreateBody
6566
Write-Information 'Creating password'
6667
$APIPassword = New-GraphPOSTRequest -uri "https://graph.microsoft.com/v1.0/applications/$($APIApp.id)/addPassword" -AsApp $true -NoAuthCheck $true -type POST -body "{`"passwordCredential`":{`"displayName`":`"Generated by API Setup`"}}"
@@ -118,9 +119,6 @@ function New-CIPPAPIConfig {
118119
$ErrorMessage = Get-CippException -Exception $_
119120
Write-Information ($ErrorMessage | ConvertTo-Json -Depth 10)
120121
Write-LogMessage -headers $Headers -API $APINAME -tenant 'None' -message "Failed to setup CIPP-API Access: $($ErrorMessage.NormalizedError) Linenumber: $($_.InvocationInfo.ScriptLineNumber)" -Sev 'Error' -LogData $ErrorMessage
121-
return @{
122-
Results = "Failed to setup CIPP-API Access: $($ErrorMessage.NormalizedError)"
123-
}
124-
122+
throw "Failed to setup CIPP-API Access: $($ErrorMessage.NormalizedError)"
125123
}
126124
}

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Settings/Invoke-ExecApiClient.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ function Invoke-ExecApiClient {
5050
$AddUpdateSuccess = $true
5151
} catch {
5252
$AddedText = "Could not modify App Registrations. Check the CIPP documentation for API requirements. Error: $($_.Exception.Message)"
53-
$Body = $Body | Select-Object * -ExcludeProperty CIPPAPI
5453
}
5554
}
5655

0 commit comments

Comments
 (0)