Skip to content

Commit 49d629e

Browse files
committed
Update Get-CippApiAuth.ps1
1 parent 97dc672 commit 49d629e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,12 @@ function Get-CippApiAuth {
4141
}
4242
}
4343

44+
$ExtractedTenantId = $Issuer -replace 'https://sts.windows.net/', '' -replace 'https://login.microsoftonline.com/', '' -replace '/v2.0', ''
45+
$TenantId = if ($ExtractedTenantId -eq 'common') { $env:TenantID } else { $ExtractedTenantId }
46+
4447
[PSCustomObject]@{
4548
ApiUrl = "https://$($env:WEBSITE_HOSTNAME)"
46-
TenantID = $Issuer -replace 'https://sts.windows.net/', '' -replace 'https://login.microsoftonline.com/', '' -replace '/v2.0', ''
49+
TenantID = $TenantId
4750
ClientIDs = $AllowedApps
4851
Enabled = $AAD.enabled
4952
}

0 commit comments

Comments
 (0)