Table of Contents

Configure Consumer Gmail Federation Through Microsoft Entra ID

This guide configures consumer Gmail accounts as Microsoft Entra B2B guest identities for FoundationaLLM.

The resulting authentication flow is:

Consumer Gmail account
  -> Google authentication
  -> Microsoft Entra B2B guest
  -> Entra-issued FoundationaLLM access token
  -> FoundationaLLM portal and API

Microsoft Entra ID remains the token issuer for FoundationaLLM. The existing portal app registrations, API scopes, Microsoft Graph group lookup, and FoundationaLLM role-based access control remain unchanged.

Important: The built-in Google federation provider described here is intended for consumer Gmail accounts. Use SAML/WS-Fed federation for Google Workspace domains.

Prerequisites

Before starting, collect:

  • The Microsoft Entra tenant ID.
  • The tenant's initial domain, such as contoso.onmicrosoft.com.
  • The User Portal or Agent Portal URL.
  • A Google account that can own or administer a Google Cloud project.
  • An Entra account with at least the External Identity Provider Administrator role.
  • An Entra account with permission to invite guest users and manage the FLLM-Users group.
  • A consumer Gmail account for testing.

For production, create the Google Cloud project under an organization-controlled Google Workspace or Cloud Identity account. A personal Gmail account can be used for a proof of concept, but enable multifactor authentication and add another trusted project owner.

Create and test an emergency Global Administrator account that uses the tenant's *.onmicrosoft.com domain before changing external identity or Conditional Access settings.

Locate the Entra tenant values

Tenant ID

In the Microsoft Entra admin center, open Entra ID > Overview and record the Tenant ID.

Initial domain

Open Entra ID > Domain names > Custom domain names and locate the domain marked Initial. It ends in .onmicrosoft.com.

The custom primary domain is not a substitute for the initial domain when configuring the Google redirect URI.

You can also retrieve the initial domain from Azure Cloud Shell:

az rest --method GET `
  --url "https://graph.microsoft.com/v1.0/domains?`$select=id,isInitial" `
  --query "value[?isInitial].id" -o tsv

Use the canonical lowercase form of the initial domain in redirect URIs. Google performs strict redirect URI matching, and the tenant domain is part of the URI path.

Create the Google Cloud OAuth application

Create or select a project

  1. Sign in to the Google Cloud console.
  2. Create or select the project that will contain the federation OAuth client.
  3. Open Google Auth Platform > Overview.
  4. Select Get started if Google Auth Platform has not been configured.

Configure Google Auth Platform

Enter:

  • App name: A recognizable value such as FoundationaLLM Entra Federation.
  • User support email: An actively monitored address.
  • Audience: External.
  • Contact email: An actively monitored address.

Accept the Google API Services policy and create the configuration.

Create the OAuth client

  1. Open Google Auth Platform > Clients.
  2. Select Create client.
  3. Set Application type to Web application.
  4. Enter a name such as Microsoft Entra B2B.
  5. Add these authorized redirect URIs:
https://login.microsoftonline.com
https://login.microsoftonline.com/te/<TENANT-ID>/oauth2/authresp
https://login.microsoftonline.com/te/<INITIAL-DOMAIN>/oauth2/authresp

For example:

https://login.microsoftonline.com
https://login.microsoftonline.com/te/11111111-2222-3333-4444-555555555555/oauth2/authresp
https://login.microsoftonline.com/te/contoso.onmicrosoft.com/oauth2/authresp
  1. Create the client.
  2. Securely record the client ID and client secret.

Do not place the Google client secret in FoundationaLLM App Configuration, source control, portal environment files, or support messages.

Configure Google federation in Entra

  1. Sign in to the Microsoft Entra admin center.
  2. Confirm that the active directory is the tenant hosting FoundationaLLM.
  3. Open Entra ID > External Identities > All identity providers.
  4. On the Built-in tab, locate Google and select Configure.
  5. Enter the Google OAuth client ID and client secret.
  6. Save the identity provider.

The Google credentials belong only in this identity provider configuration. Do not add them to a FoundationaLLM app registration.

Prepare a Gmail test user

Allow the test account in Google

In Google Auth Platform > Audience, check the publishing status:

  • If the application is in Testing, add the exact Gmail test address under Test users.
  • If the application is in production, a separate test-user entry is not required.

Keep the application in Testing until the initial end-to-end validation succeeds.

Invite the user into Entra

  1. In Entra, open Entra ID > Users.
  2. Select New user > Invite external user.
  3. Enter the exact Gmail address configured as the Google test user.
  4. Send the invitation.
  5. Add the resulting guest user to the FLLM-Users Entra security group.
  6. Have the user open the invitation in an Incognito or InPrivate browser window.
  7. The user must redeem the invitation with the same Google account that was invited.

After redemption, verify:

  • User type is Guest.
  • B2B invitation state is Accepted.
  • The guest has an Entra object ID.
  • Google is associated with the external identity.

The guest's Entra user principal name can appear in an externalized form such as:

gmail-name_gmail.com#EXT#@contoso.onmicrosoft.com

This is expected. FoundationaLLM authorization uses the stable Entra object ID and group memberships.

Grant FoundationaLLM access

Entra group membership and FoundationaLLM role assignments are separate authorization layers.

User Portal

In the Management Portal:

  1. Open Security > Role Assignments.
  2. Select Portal Access.
  3. Select User Portal.
  4. Ensure FLLM-Users has the Reader role.

The effective scope is:

providers/FoundationaLLM.Configuration/appConfigurationSets/UserPortal

See Configure Chat User Portal Access.

Agent Portal

For deployments that include the separate Agent Portal, ensure FLLM-Users has the Reader role on:

providers/FoundationaLLM.Configuration/appConfigurationSets/AgentPortal

Management Portal

Only add administrative users to FLLM-Admins. Ensure that group has the Reader role on:

providers/FoundationaLLM.Configuration/appConfigurationSets/ManagementPortal

See Configure Management Portal Access.

If an Entra enterprise application has Assignment required? enabled, also assign the appropriate group to the corresponding portal enterprise application.

Complete multifactor authentication registration

Conditional Access or Entra security defaults can display Let's keep your account secure after the guest authenticates with Google.

This is expected. Google federation supplies the primary authentication, while Entra can still require an additional authentication method. Select Next and complete the available method, typically Microsoft Authenticator.

After registration, Entra should return the user to the requested portal. If it does not, close the Incognito session and start a new portal sign-in.

Allow time for propagation

Several independent systems update during first-time setup:

  • Google OAuth client and audience configuration.
  • Entra external identity provider configuration.
  • B2B invitation redemption.
  • Entra group membership.
  • FoundationaLLM's Microsoft Graph group lookup.
  • MFA and security-information registration.
  • Browser and token caches.

Allow approximately 5-10 minutes after creating the identity provider or redeeming the first invitation before treating a failure as persistent. Group membership and newly registered authentication methods can also require several minutes to become consistently visible.

During this window:

  1. Do not immediately recreate the guest, rotate the OAuth secret, or disable MFA.
  2. Wait a few minutes.
  3. Close the current Incognito or InPrivate session.
  4. Start a new private session to force fresh Entra and FoundationaLLM tokens.
  5. Navigate directly to the FoundationaLLM portal instead of reusing the invitation link.

A transient InternalServerError on the Keep your account secure page immediately after invitation redemption can be caused by this propagation window. If the B2B invitation state is Accepted, Google authentication and invitation redemption have already succeeded. Retry MFA registration after the propagation delay.

Verify the complete flow

Use a fresh Incognito or InPrivate session:

  1. Navigate directly to the User Portal or Agent Portal.
  2. Select Sign in.
  3. Enter the invited Gmail address on the Microsoft sign-in page.
  4. Confirm redirection to Google.
  5. Authenticate with the invited Google account.
  6. Complete Entra MFA if prompted.
  7. Confirm return to FoundationaLLM.
  8. Open an agent and perform an API-backed action.
  9. Verify that a Gmail guest without the required FoundationaLLM role assignment is denied access.

The access token presented to FoundationaLLM should still be issued by the Entra tenant and contain the Entra object ID and the appropriate Core or Management API scope.

Troubleshooting

Google access is blocked

  • Confirm the Google application audience is External.
  • If its publishing status is Testing, add the exact Gmail address as a test user.
  • Confirm all three redirect URIs exactly match the configured values.
  • Confirm that the invited account is the Google account selected during sign-in.

B2B invitation is accepted, but Keep your account secure fails

The Google federation step succeeded. Record the error code, correlation ID, and UTC timestamp.

  1. Wait 5-10 minutes and retry in a new private browser session.
  2. Open Entra ID > Diagnose & solve problems > Sign-in diagnostic.
  3. Search using the correlation ID and timestamp.
  4. Review Conditional Access, authentication methods, and security-information registration policies.

The security-registration failure might not appear as a failed sign-in because primary authentication already succeeded.

The Gmail address is not visible in sign-in logs

Search by the guest's Entra object ID or externalized UPN instead of the original Gmail address. Clear status filters and inspect all interactive sign-ins around the UTC timestamp.

FoundationaLLM returns access denied

  • Confirm the guest is a member of FLLM-Users or FLLM-Admins.
  • Confirm the group has the required FoundationaLLM Reader role on the relevant portal configuration scope.
  • If enterprise application assignment is required, confirm that assignment.
  • Wait for membership propagation and sign in again to obtain fresh tokens.

Redirect URI errors

Confirm that the initial domain, not the custom primary domain, is used in the third Google redirect URI. Keep the initial domain lowercase.

Move from testing to production

After successful validation:

  1. Review the Google Auth Platform branding and contact details.
  2. Publish the Google application for external use.
  3. Verify whether Google requires application verification.
  4. Add a second trusted Google Cloud project owner.
  5. Document ownership and recovery procedures.
  6. Establish a client-secret rotation process.
  7. Review Entra external collaboration and Conditional Access policies before onboarding additional users.