Skip to content

Commit 85ae0b9

Browse files
committed
adjust casing
catch errors
1 parent 37d324e commit 85ae0b9

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

Modules/CIPPCore/Public/Authentication/Get-CippApiAuth.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ function Get-CippApiAuth {
77
if ($env:MSI_SECRET) {
88
Disable-AzContextAutosave -Scope Process | Out-Null
99
$null = Connect-AzAccount -Identity
10-
$SubscriptionId = $ENV:WEBSITE_OWNER_NAME -split '\+' | Select-Object -First 1
10+
$SubscriptionId = $env:WEBSITE_OWNER_NAME -split '\+' | Select-Object -First 1
11+
$Context = Set-AzContext -SubscriptionId $SubscriptionId -TenantId $env:TenantId -ErrorAction Stop
1112
} else {
1213
$Context = Get-AzContext
1314
$SubscriptionId = $Context.Subscription.Id

Modules/CIPPCore/Public/Authentication/Set-CippApiAuth.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function Set-CippApiAuth {
1010
if ($env:MSI_SECRET) {
1111
Disable-AzContextAutosave -Scope Process | Out-Null
1212
$null = Connect-AzAccount -Identity
13-
$SubscriptionId = $ENV:WEBSITE_OWNER_NAME -split '\+' | Select-Object -First 1
13+
$SubscriptionId = $env:WEBSITE_OWNER_NAME -split '\+' | Select-Object -First 1
1414
$Context = Set-AzContext -SubscriptionId $SubscriptionId
1515
} else {
1616
$Context = Get-AzContext

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ function Invoke-ExecApiClient {
107107
} catch {
108108
$Results = @{
109109
Enabled = 'Could not get API clients, ensure you have the appropriate rights to read the Authentication settings.'
110+
Error = (Get-CippException -Exception $_)
110111
}
111112
}
112113
$Body = @{
@@ -124,7 +125,10 @@ function Invoke-ExecApiClient {
124125
$Body = @{ Results = 'API clients saved to Azure' }
125126
Write-LogMessage -headers $Request.Headers -API 'ExecApiClient' -message 'Saved API clients to Azure' -Sev 'Info'
126127
} catch {
127-
$Body = @{ Results = 'Failed to save allowed API clients to Azure, ensure your function app has the appropriate rights to make changes to the Authentication settings.' }
128+
$Body = @{
129+
Results = 'Failed to save allowed API clients to Azure, ensure your function app has the appropriate rights to make changes to the Authentication settings.'
130+
Error = (Get-CippException -Exception $_)
131+
}
128132
Write-Information (Get-CippException -Exception $_ | ConvertTo-Json)
129133
}
130134
}

0 commit comments

Comments
 (0)