Skip to content

Commit fa42620

Browse files
author
rvdwegen
committed
Better tenant lookup
1 parent fdc5462 commit fa42620

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

Modules/CIPPCore/Public/Entrypoints/Invoke-ListExternalTenantInfo.ps1

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,24 @@ function Invoke-ListExternalTenantInfo {
2222

2323
if ($TenantId) {
2424
$GraphRequest = New-GraphGetRequest -uri "https://graph.microsoft.com/beta/tenantRelationships/findTenantInformationByTenantId(tenantId='$TenantId')" -NoAuthCheck $true -tenantid $env:TenantID
25+
26+
27+
# New API call to retrieve branding details
28+
$brandingBody = @{
29+
username = "completelymadeupdoesnthavetobevalid@$($GraphRequest.defaultDomainName)"
30+
} | ConvertTo-Json
31+
32+
$brandingHeaders = @{
33+
"Content-Type" = "application/json"
34+
}
35+
36+
$brandingResponse = Invoke-RestMethod -Method Post -Uri "https://login.microsoftonline.com/common/GetCredentialType" -Body $brandingBody -Headers $brandingHeaders
37+
2538
$StatusCode = [HttpStatusCode]::OK
2639
$HttpResponse.Body = [PSCustomObject]@{
2740
GraphRequest = $GraphRequest
2841
OpenIdConfig = $OpenIdConfig
42+
UserTenantBranding = $brandingResponse.EstsProperties.UserTenantBranding
2943
}
3044
} else {
3145
$HttpResponse.StatusCode = [HttpStatusCode]::BadRequest

0 commit comments

Comments
 (0)