Skip to content

Commit b0c96a1

Browse files
committed
Update Get-CippApiAuth.ps1
1 parent 106272f commit b0c96a1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ function Get-CippApiAuth {
2020
}
2121

2222
# Get auth settings
23-
$AuthSettings = Invoke-AzRestMethod -Uri "https://management.azure.com/subscriptions/$SubscriptionId/resourceGroups/$RGName/providers/Microsoft.Web/sites/$($FunctionAppName)/config/authsettingsV2/list?api-version=2020-06-01" -ErrorAction Stop | Select-Object -ExpandProperty Content | ConvertFrom-Json
23+
$AuthSettings = (Invoke-AzRestMethod -Uri "https://management.azure.com/subscriptions/$SubscriptionId/resourceGroups/$RGName/providers/Microsoft.Web/sites/$($FunctionAppName)/config/authsettingsV2/list?api-version=2020-06-01" -ErrorAction Stop | Select-Object -ExpandProperty Content | ConvertFrom-Json).properties
2424
}
2525

26-
if ($AuthSettings.properties) {
26+
if ($AuthSettings) {
2727
[PSCustomObject]@{
2828
ApiUrl = "https://$($env:WEBSITE_HOSTNAME)"
29-
TenantID = $AuthSettings.properties.identityProviders.azureActiveDirectory.registration.openIdIssuer -replace 'https://sts.windows.net/', '' -replace '/v2.0', ''
30-
ClientIDs = $AuthSettings.properties.identityProviders.azureActiveDirectory.validation.defaultAuthorizationPolicy.allowedApplications
31-
Enabled = $AuthSettings.properties.identityProviders.azureActiveDirectory.enabled
29+
TenantID = $AuthSettings.identityProviders.azureActiveDirectory.registration.openIdIssuer -replace 'https://sts.windows.net/', '' -replace '/v2.0', ''
30+
ClientIDs = $AuthSettings.identityProviders.azureActiveDirectory.validation.defaultAuthorizationPolicy.allowedApplications
31+
Enabled = $AuthSettings.identityProviders.azureActiveDirectory.enabled
3232
}
3333
} else {
3434
throw 'No auth settings found'

0 commit comments

Comments
 (0)