Skip to content

Commit 4e6385b

Browse files
committed
Update Get-CippApiAuth.ps1
1 parent 17203b2 commit 4e6385b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@ function Get-CippApiAuth {
66

77
$SubscriptionId = Get-CIPPAzFunctionAppSubId
88

9-
# Get auth settings via REST
10-
$uri = "https://management.azure.com/subscriptions/$SubscriptionId/resourceGroups/$RGName/providers/Microsoft.Web/sites/$($FunctionAppName)/config/authsettingsV2/list?api-version=2020-06-01"
11-
$response = New-CIPPAzRestRequest -Uri $uri -Method POST -ErrorAction Stop
12-
$AuthSettings = $response.properties
9+
try {
10+
# Get auth settings via REST
11+
$uri = "https://management.azure.com/subscriptions/$SubscriptionId/resourceGroups/$RGName/providers/Microsoft.Web/sites/$($FunctionAppName)/config/authsettingsV2/list?api-version=2020-06-01"
12+
$response = New-CIPPAzRestRequest -Uri $uri -Method POST -ErrorAction Stop
13+
$AuthSettings = $response.properties
14+
} catch {
15+
Write-Warning "Failed to get auth settings via REST: $($_.Exception.Message)"
16+
}
1317

1418
if (!$AuthSettings -and $env:WEBSITE_AUTH_V2_CONFIG_JSON) {
1519
$AuthSettings = $env:WEBSITE_AUTH_V2_CONFIG_JSON | ConvertFrom-Json -ErrorAction SilentlyContinue

0 commit comments

Comments
 (0)