@@ -66,7 +66,7 @@ function Invoke-ExecListAppId {
6666
6767 if ($AppResponse.body ) {
6868 $AppWeb = $AppResponse.body.web
69- if ($AppWeb.redirectUris -and $AppWeb .redirectUris.Count -gt 0 ) {
69+ if ($AppWeb.redirectUris ) {
7070 # construct new redirect uri with current
7171 $URL = ($Request.headers .' x-ms-original-url' ).split(' /api' ) | Select-Object - First 1
7272 $NewRedirectUri = " $ ( $URL ) /authredirect"
@@ -87,23 +87,24 @@ function Invoke-ExecListAppId {
8787 }
8888 }
8989 }
90- } catch {
91- Write-LogMessage - message ' Failed to retrieve organization info and authenticated user' - LogData (Get-CippException - Exception $_ ) - Sev ' Warning'
92- }
93-
94- $Results = @ {
95- applicationId = $env: ApplicationID
96- tenantId = $env: TenantID
97- orgName = $OrgInfo.displayName
98- authenticatedUserDisplayName = $AuthenticatedUserDisplayName
99- authenticatedUserPrincipalName = $AuthenticatedUserPrincipalName
100- isPartnerTenant = !! $OrgInfo.partnerTenantType
101- partnerTenantType = $OrgInfo.partnerTenantType
102- refreshUrl = " https://login.microsoftonline.com/$env: TenantID /oauth2/v2.0/authorize?client_id=$env: ApplicationID &response_type=code&redirect_uri=$ResponseURL &response_mode=query&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default+offline_access+profile+openid&state=1&prompt=select_account"
103- }
104- return [HttpResponseContext ]@ {
105- StatusCode = [HttpStatusCode ]::OK
106- Body = $Results
10790 }
91+ } catch {
92+ Write-LogMessage - message ' Failed to retrieve organization info and authenticated user' - LogData (Get-CippException - Exception $_ ) - Sev ' Warning'
93+ }
10894
95+ $Results = @ {
96+ applicationId = $env: ApplicationID
97+ tenantId = $env: TenantID
98+ orgName = $OrgInfo.displayName
99+ authenticatedUserDisplayName = $AuthenticatedUserDisplayName
100+ authenticatedUserPrincipalName = $AuthenticatedUserPrincipalName
101+ isPartnerTenant = !! $OrgInfo.partnerTenantType
102+ partnerTenantType = $OrgInfo.partnerTenantType
103+ refreshUrl = " https://login.microsoftonline.com/$env: TenantID /oauth2/v2.0/authorize?client_id=$env: ApplicationID &response_type=code&redirect_uri=$ResponseURL &response_mode=query&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default+offline_access+profile+openid&state=1&prompt=select_account"
104+ }
105+ return [HttpResponseContext ]@ {
106+ StatusCode = [HttpStatusCode ]::OK
107+ Body = $Results
109108 }
109+
110+ }
0 commit comments