user-guides

How Single Sign-On Works for Contoso360 and Power BI


Proposed Flow: End-Customer Authentication Flow (User vs Behind-the-Scenes)

  1. User logs into the Contoso360 portal via SSO (SAML) or credentials
    (User action — navigates to Contoso360.com and authenticates via Keycloak. A Keycloak session is created.)

  2. User clicks a Power BI link within the portal to view analytics/reports
    (User action — selects an analytics/report feature/navigational element in the portal. Session is still active from portal login.)

  3. Portal generates a deep link to the user’s Power BI workspace/report
    (Behind the scenes — Portal backend determines customer context, product/workspace, and generates correct Power BI URL, e.g. https://app.powerbi.com/groups/customer-a-workspace/reports/...)

  4. Browser is redirected to Power BI site
    (Browser navigates to the Power BI URL. User leaves the portal site, now at app.powerbi.com.)

  5. Power BI checks for Microsoft authentication
    (Behind the scenes — Power BI sees no active Azure AD session for the user, and so redirects to Azure Entra ID for login)

  6. Azure Entra ID examines the email/domain
    (Behind the scenes — During login or home realm discovery, Entra ID detects the user’s domain, e.g., @customer-a.com)

  7. Azure Entra ID identifies the domain is SAML-federated and redirects to Keycloak
    (Behind the scenes — Entra ID auto-redirects to Keycloak as the federated IdP for @customer-a.com users)

  8. Keycloak checks for an existing browser session
    • If session from step 1 is still valid (e.g. <8 hours):
      NO login required — user is recognized; SSO proceeds seamlessly.
    • If session expired or browser cookies cleared:
      User is prompted by Keycloak to enter credentials (login again).
  9. Keycloak generates a SAML assertion and returns to Azure Entra ID
    (Behind the scenes — Keycloak validates the session, then signs and sends a SAML assertion back to Entra.)

  10. Azure Entra ID validates the SAML assertion and issues a token
    (Behind the scenes — Entra checks signature, timestamps, certificate, and creates/updates the user if needed.)

  11. User is redirected back to Power BI with the Azure Entra-issued token
    (Behind the scenes — SSO/OIDC protocol, browser is pointed back to the intended Power BI report/workspace)

  12. Power BI validates the Entra token and grants access based on Azure roles/groups/RLS
    (Behind the scenes — Power BI recognizes user as user@customer-a.com, applies licensing, group, RBAC, and row-level security rules to show correct data. User sees reports.)

Goal: End-customers log in once to Contoso360 portal, then click a button to see their Power BI reports without logging in again if their Keycloak session is still active.

How we achieve this:
We connect three systems together using SAML/OIDC federation and user session management:

  1. Contoso360 Portal: Where users begin, authenticating via Keycloak as the IAM
  2. Keycloak: Identity provider that authenticates the user, manages session/cookies, and federates to Microsoft as needed
  3. Microsoft (Azure Entra ID & Power BI): Consumes SAML assertions, creates tokens/account, grants data access via workspace and security groups

The User Story: User Sarah at healthcare

Morning - 9:00 AM: Sarah Logs Into the Portal


15 Minutes Later - 9:15 AM: Sarah Wants to See Reports


CRITICAL POINT

If Sarah’s Keycloak session is still active from her portal login, she will not see any additional login prompt when accessing Power BI—a seamless SSO experience.


Important


Visual timeline

1. Sarah logs in at Contoso360.com (Keycloak session started)
2. Sarah uses portal as normal
3. [15 minutes later] Sarah clicks "View Reports"
4. Browser→Power BI→Microsoft→Keycloak→(session valid=no login needed)
5. Power BI shows reports instantly — NO login screen!
6. [8 hours later, session expired] Keycloak asks for login again

What does the user see? (short)


Behind the Scenes: SSO Magic


Security Mechanisms in Play


Limitation