Chapter 2: Identity & Single Sign-On
Part I: Foundation & Identity Prerequisites: Chapter 1: Enterprise Subscription & Environment Setup GH-100 Exam Mapping: Domain 2 (Manage user identities and GitHub authentication — 11%) Verified: 2026-02-01 against official documentation
1. Introduction
Learning Objectives
After completing this chapter, you will be able to:
- Compare Enterprise Managed Users (EMU) with personal accounts using SAML Single Sign-On (SSO) and identify when each model is appropriate
- Configure Security Assertion Markup Language (SAML) SSO between Microsoft Entra ID and a GitHub Enterprise Cloud organization
- Set up OpenID Connect (OIDC) authentication for an EMU enterprise with Microsoft Entra ID
- Implement conditional access policies and session management controls for GitHub Enterprise access
- Describe how System for Cross-domain Identity Management (SCIM) provisioning works alongside SAML and OIDC authentication
Exam Domain Coverage
| Domain | Topics in This Chapter |
|---|---|
| D2: Manage user identities and GitHub authentication (11%) | EMU vs. personal account models, SAML SSO configuration, OIDC authentication, identity provider integration, session management, conditional access |
Chapter Overview
Identity and access management is the security foundation of any enterprise GitHub deployment. Before enabling Copilot policies, configuring repository access controls, or deploying coding agents, organizations must first establish how users authenticate to GitHub and how their identities are managed. For enterprises with 50 or more developers, getting identity right from the start prevents costly rework and security gaps later.
GitHub Enterprise Cloud offers two fundamentally different identity models: personal accounts with SAML SSO enforcement, and Enterprise Managed Users (EMU) where the identity provider (IdP) fully controls user lifecycle. Each model has distinct implications for developer experience, security posture, and administrative overhead. This chapter examines both models in depth and walks you through configuring Microsoft Entra ID (formerly Azure Active Directory) as your identity provider using both SAML and OIDC protocols.
By the end of this chapter, you will have a working SAML SSO integration between Microsoft Entra ID and your GitHub Enterprise Cloud trial, understand the tradeoffs between EMU and personal account models, and know how to apply conditional access policies that enforce your organization's security requirements.
2. Theory & Deep Dive
Identity Models: EMU vs. Personal Accounts with SAML
GitHub Enterprise Cloud supports two identity models. The choice between them is one of the most consequential architectural decisions an enterprise will make, and it should be decided before onboarding any developers.
Personal Accounts with SAML SSO
In this model, developers create their own GitHub.com accounts (or use existing ones) and link them to the enterprise through SAML SSO. The enterprise enforces SAML authentication at the organization or enterprise level, meaning users must authenticate through the corporate IdP to access enterprise resources.
Key characteristics:
- Developers own their GitHub accounts and retain them if they leave the organization
- A single GitHub account can participate in multiple enterprises and open source projects
- The enterprise enforces SAML authentication but does not control the account itself
- Usernames are chosen by the developer and are not derived from the IdP
- Personal contributions (open source, side projects) coexist on the same account
- Two-factor authentication (2FA) can be required at the organization level but is managed by the user
When to use this model:
- Organizations that want developers to contribute to open source under the same identity
- Enterprises transitioning gradually from free GitHub usage to managed enterprise access
- Companies that prefer a lighter-touch identity model with SAML enforcement only for enterprise resources
Enterprise Managed Users (EMU)
In the EMU model, user accounts are created and fully managed by the enterprise's IdP through SCIM provisioning. Developers do not create their own accounts; instead, accounts are provisioned automatically when users are assigned to the GitHub EMU application in the IdP.
Key characteristics:
- User accounts are owned and controlled by the enterprise, not the individual
- Usernames follow a predictable pattern:
IdP-username_enterprise-shortcode(e.g.,jsmith_contoso) - When a user is deprovisioned in the IdP, their GitHub EMU account is suspended automatically
- EMU accounts cannot contribute to public repositories or organizations outside the enterprise
- All authentication is controlled exclusively through the IdP; no password-based GitHub login exists
- SCIM provisioning is mandatory and handles user creation, updates, and deactivation
- Enterprise owners can choose between SAML and OIDC for the authentication protocol
When to use this model:
- Organizations with strict identity governance requirements (financial services, healthcare, government)
- Enterprises that require full lifecycle management of developer accounts
- Companies where developers should not have a personal GitHub presence linked to their work account
- Organizations that need conditional access policy enforcement via OIDC (see section on OIDC below)
| Feature | Personal Accounts + SAML | Enterprise Managed Users |
|---|---|---|
| Account ownership | Developer | Enterprise |
| Username format | User-chosen | idp-username_shortcode |
| Open source contributions | Same account | Separate personal account required |
| SCIM provisioning | Optional (for team sync) | Mandatory |
| Account on offboarding | Unlinked, still exists | Suspended/deleted |
| Authentication protocols | SAML | SAML or OIDC |
| Conditional access (IdP) | Limited | Full (with OIDC) |
| Outside collaborators | Supported | Supported (limited) |
Enterprise Scenario: A 300-developer healthcare company evaluates both models. Their compliance team requires that when a developer leaves, all GitHub access is immediately revoked with no residual account. They also need Microsoft Entra ID conditional access policies to restrict GitHub access to compliant, managed devices. They select EMU with OIDC authentication because it provides full account lifecycle control through SCIM, immediate suspension on deprovisioning, and native conditional access policy enforcement through OIDC token validation.
SAML SSO: How It Works with GitHub
SAML 2.0 is a widely adopted standard for exchanging authentication and authorization data between an IdP (such as Microsoft Entra ID) and a service provider (SP), in this case GitHub. When SAML SSO is configured:
- A user navigates to GitHub and attempts to access an organization or enterprise resource
- GitHub redirects the user to the configured IdP (Microsoft Entra ID)
- The user authenticates with the IdP (password, multi-factor authentication, etc.)
- The IdP generates a signed SAML assertion containing user attributes (NameID, email, display name)
- The user's browser posts the SAML assertion back to GitHub's Assertion Consumer Service (ACS) URL
- GitHub validates the assertion signature, extracts identity claims, and grants access
SAML Configuration Parameters for GitHub:
The following parameters must be configured in both the IdP and GitHub:
| Parameter | Value Pattern |
|---|---|
| Identifier (Entity ID) | https://github.com/enterprises/{enterprise} (enterprise-level) or https://github.com/orgs/{org} (org-level) |
| Reply URL (ACS) | https://github.com/enterprises/{enterprise}/saml/consume or https://github.com/orgs/{org}/saml/consume |
| Sign-on URL | https://github.com/enterprises/{enterprise}/sso or https://github.com/orgs/{org}/sso |
| NameID format | urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress |
| Signing Certificate | PEM-encoded certificate downloaded from IdP |
SAML Attribute Mapping:
GitHub expects specific attributes in the SAML assertion. For Microsoft Entra ID:
| SAML Attribute | Entra ID Source | Purpose |
|---|---|---|
NameID | user.mail (recommended) or user.userprincipalname | Primary identifier for linking IdP identity to GitHub account |
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name | user.userprincipalname | Display name resolution |
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress | user.mail | Email verification |
Enterprise Scenario: A 150-developer retail company configures SAML SSO for their three GitHub organizations. During initial testing, users report being unable to sign in. Investigation reveals the NameID attribute was mapped to
user.userprincipalname(which uses the formatuser@contoso.onmicrosoft.com) instead ofuser.mail(which usesuser@contoso.com). The mismatch between the SAML NameID and users' verified GitHub email addresses caused authentication failures. After correcting the attribute mapping touser.mail, all users authenticate successfully.
OIDC Authentication for EMU Enterprises
OpenID Connect (OIDC) is an identity layer built on top of OAuth 2.0. For EMU enterprises, OIDC provides a significant advantage over SAML: native support for Conditional Access Policies (CAP) from the IdP. When an EMU enterprise uses OIDC with Microsoft Entra ID, GitHub validates the IdP's access token on every API request and web session, enabling real-time enforcement of conditional access policies.
Why OIDC matters for EMU:
- Conditional Access Policy (CAP) enforcement: Microsoft Entra ID can enforce policies such as requiring compliant devices, specific network locations, or risk-based authentication. With OIDC, GitHub respects these policies in real time.
- Token-based session validation: OIDC tokens have defined lifetimes and can be revoked. When a conditional access policy is violated (e.g., a user moves to an untrusted network), the token is invalidated and the user must re-authenticate.
- Simplified session management: Unlike SAML where session management relies on periodic reauthentication, OIDC integrates directly with the IdP's session lifecycle.
OIDC vs. SAML for EMU — When to Choose Each:
| Consideration | SAML | OIDC |
|---|---|---|
| Conditional access policy support | Not natively supported | Fully supported |
| IdP compatibility | Any SAML 2.0 IdP | Microsoft Entra ID only (for GitHub EMU) |
| Token/session revocation | Relies on session timeout | Real-time via token validation |
| Setup complexity | Moderate | Moderate |
| Recommended for | Non-Entra IdPs (Okta, PingFederate) | Microsoft Entra ID environments |
Important: As of the verification date, OIDC for GitHub EMU is supported only with Microsoft Entra ID. If your enterprise uses a different IdP (such as Okta or PingFederate), you must use SAML for EMU authentication.
Enterprise Scenario: A 500-developer financial services firm uses Microsoft Entra ID and has strict conditional access policies requiring managed, compliant devices for all SaaS access. With SAML, they discovered that developers who fell out of compliance (e.g., removed Intune management) could continue accessing GitHub until their session expired. By switching to OIDC, conditional access policies are evaluated on each token refresh, immediately blocking non-compliant devices from GitHub access.
Configuring SAML SSO with Microsoft Entra ID
The configuration process involves parallel setup in both Microsoft Entra ID and GitHub. The following describes the enterprise-level SAML configuration, which enforces SSO across all organizations within the enterprise.
Microsoft Entra ID Side — Required Steps:
-
Add the application: In the Microsoft Entra admin center (
entra.microsoft.com), navigate to Entra ID > Enterprise applications > New application. Search for and add the appropriate gallery application:- For EMU: GitHub Enterprise Managed User
- For personal accounts at the enterprise level: GitHub Enterprise Cloud - Enterprise Account
- For personal accounts at the org level: GitHub (organization SSO)
-
Configure Basic SAML settings: Edit the Basic SAML Configuration section:
- Identifier (Entity ID):
https://github.com/enterprises/{enterprise-slug}(no trailing slash) - Reply URL:
https://github.com/enterprises/{enterprise-slug}/saml/consume - Sign-on URL:
https://github.com/enterprises/{enterprise-slug}/sso
- Identifier (Entity ID):
-
Configure attribute mappings: Edit user attributes to map:
- Unique User Identifier (Name ID) to
user.mail - Ensure email, name, and display name claims are included
- Unique User Identifier (Name ID) to
-
Download the certificate: Download the Certificate (Base64) or Certificate (PEM) from the SAML Signing Certificate section. For EMU, PEM format is preferred.
-
Copy configuration URLs: Note the Login URL, Microsoft Entra Identifier (Issuer), and Logout URL from the application setup page.
-
Assign users and groups: Under Users and groups, assign the Entra ID security groups or individual users who should have access to GitHub. For EMU, role assignments (Enterprise Owner, Member) are configured here.
GitHub Side — Required Steps:
- Sign in to GitHub as an enterprise owner (or the setup user for EMU).
- Navigate to Settings > Authentication security (for organizations) or enterprise Settings > Authentication (for enterprise accounts).
- Enter the Sign-on URL (this is the Login URL from Entra ID).
- Enter the Issuer (this is the Microsoft Entra Identifier from Entra ID).
- Paste the contents of the downloaded public certificate into the Public certificate field.
- For non-EMU setups: Verify the Signature Method is
RSA-SHA256and Digest Method isSHA256. - Click Test SAML configuration to validate the integration.
- Save the configuration.
Post-Configuration for Personal Account SAML:
After enabling SAML SSO, organization members must individually authorize their SAML identity. They are prompted the next time they access the organization. Enterprise owners can also require SAML SSO, which blocks access for any member who has not completed SAML authorization.
OIDC Configuration for EMU Enterprises
OIDC configuration for EMU with Microsoft Entra ID uses a separate gallery application: GitHub Enterprise Managed User (OIDC).
Microsoft Entra ID Side:
- Add the GitHub Enterprise Managed User (OIDC) application from the gallery
- Configure single sign-on using OIDC (not SAML)
- The application automatically configures the required OIDC endpoints
- Assign users and groups with appropriate roles (Enterprise Owner, Member)
Provisioning (SCIM) Setup:
Both SAML and OIDC EMU setups require SCIM provisioning. In the Entra ID application:
- Navigate to the Provisioning tab and set mode to Automatic
- Enter the Tenant URL:
https://api.github.com/scim/v2/enterprises/{enterprise}(for github.com) orhttps://api.{subdomain}.ghe.com/scim/v2/enterprises/{subdomain}(for GHE.com) - Enter the Secret Token: A Personal Access Token (PAT) created by the enterprise setup user with the
scim:enterprisescope - Test the connection and save
- Configure attribute mappings for users and groups
- Enable provisioning and trigger an initial sync
SCIM Attribute Mappings (Users):
| Microsoft Entra Attribute | GitHub SCIM Attribute | Notes |
|---|---|---|
userPrincipalName | userName | Primary identifier |
mail | emails[type eq "work"].value | Work email |
givenName | name.givenName | First name |
surname | name.familyName | Last name |
displayName | displayName | Full display name |
objectId | externalId | Immutable ID for matching |
Switch([IsSoftDeleted], , "False", "True", "True", "False") | active | Account active state |
Conditional Access Policies
Conditional Access Policies (CAP) in Microsoft Entra ID allow administrators to enforce conditions under which users can access applications. For GitHub Enterprise, these policies are critically important for organizations with compliance requirements.
Common conditional access policies for GitHub:
- Require managed devices: Block access from unmanaged personal devices
- Require Multi-Factor Authentication (MFA): Enforce MFA for all GitHub access regardless of session state
- Location-based restrictions: Block access from geographic locations outside approved regions
- Risk-based authentication: Require step-up authentication when sign-in risk is detected
- Sign-in frequency: Force reauthentication after a defined period (e.g., every 8 hours)
- Persistent browser session control: Disable "stay signed in" functionality for unmanaged devices
Conditional Access with SAML vs. OIDC:
With SAML, conditional access policies are evaluated only at the point of authentication (when the user signs in). Once a valid SAML session is established, the user can continue accessing GitHub until the session expires, even if their compliance state changes.
With OIDC (EMU only), conditional access policies are evaluated continuously through token validation. When a user's access token is refreshed, Entra ID re-evaluates all applicable conditional access policies. If the user no longer meets the conditions (e.g., their device falls out of compliance), the token refresh is denied and GitHub access is blocked.
Creating a Conditional Access Policy for GitHub:
- Sign in to the Microsoft Entra admin center as a Conditional Access Administrator
- Navigate to Entra ID > Conditional Access > Policies > New policy
- Name the policy descriptively (e.g.,
GitHub - Require compliant device and MFA) - Under Assignments > Users, include the groups assigned to your GitHub application
- Under Target resources > Cloud apps, select the GitHub Enterprise application
- Under Conditions, configure as needed:
- Device platforms: Target specific OS platforms
- Locations: Include or exclude named locations
- Client apps: Select browser and mobile apps
- Under Access controls > Grant: Select Require multifactor authentication and/or Require device to be marked as compliant
- Under Access controls > Session: Configure Sign-in frequency (e.g., 8 hours) and Persistent browser session (e.g., Never persistent)
- Set Enable policy to Report-only first, then switch to On after validation
Enterprise Scenario: A 200-developer enterprise configures a conditional access policy requiring MFA and compliant devices for their GitHub EMU enterprise. During the report-only phase, they discover that 15% of their developers use Linux workstations that are not enrolled in Intune. Rather than blocking these developers, they create a separate policy that requires MFA and a trusted network location for Linux devices, while maintaining the compliant-device requirement for Windows and macOS. This layered approach enforces security without disrupting productivity.
Session Management Best Practices
Session management controls how long a user stays authenticated and when they must re-authenticate. For GitHub Enterprise, session management spans both the IdP and GitHub itself.
Microsoft Entra ID Session Controls:
- Sign-in frequency: Configurable per-application. For GitHub, a common enterprise setting is 8-12 hours for normal access and 1 hour for privileged administrative access.
- Persistent browser session: Can be set to "Always persistent" (user stays signed in across browser restarts), "Never persistent" (user must authenticate on each browser session), or not configured (user sees the "Stay signed in?" prompt).
- Continuous Access Evaluation (CAE): For OIDC-connected applications, CAE enables near-real-time enforcement of critical events such as user account disable, password change, or admin-initiated revoke.
GitHub Session Controls:
- Session duration: GitHub sessions are valid for two weeks by default. Enterprise owners cannot directly configure this duration.
- SAML session duration: When SAML SSO is enforced, the effective session duration is the shorter of the GitHub session or the IdP session configured through conditional access policies.
- SSH key and PAT management: SAML SSO enforcement requires that SSH keys and Personal Access Tokens be authorized for SAML. Enterprise owners can set token lifetimes and require SAML authorization for API access.
3. Diagrams
SAML SSO Authentication Flow
sequenceDiagram
participant Dev as Developer Browser
participant GH as GitHub Enterprise
participant IdP as Microsoft Entra ID
Dev->>GH: 1. Access enterprise resource
GH-->>Dev: 2. Redirect to IdP (SAML AuthnRequest)
Dev->>IdP: 3. Follow redirect to Entra ID login
IdP->>IdP: 4. Authenticate user (password + MFA)
IdP->>IdP: 5. Evaluate conditional access policies
IdP-->>Dev: 6. Return signed SAML assertion
Dev->>GH: 7. POST assertion to ACS URL
GH->>GH: 8. Validate signature & extract claims
GH-->>Dev: 9. Grant access, establish session
Figure 1: SAML SSO authentication flow between a developer's browser, GitHub Enterprise (service provider), and Microsoft Entra ID (identity provider). Steps 4-5 occur at the IdP and include both credential verification and conditional access policy evaluation.
EMU Identity Model Comparison
graph TB
subgraph "Personal Accounts + SAML SSO"
PA1[Developer creates<br/>personal GitHub account]
PA2[Enterprise enforces<br/>SAML SSO]
PA3[Developer links account<br/>via SAML authorization]
PA4[Account persists after<br/>developer leaves org]
PA1 --> PA2 --> PA3 --> PA4
end
subgraph "Enterprise Managed Users (EMU)"
EMU1[Admin assigns user in<br/>Microsoft Entra ID]
EMU2[SCIM provisions account<br/>in GitHub]
EMU3[User authenticates via<br/>SAML or OIDC]
EMU4[Account suspended when<br/>user removed from IdP]
EMU1 --> EMU2 --> EMU3 --> EMU4
end
style PA1 fill:#2d333b,stroke:#539bf5,color:#adbac7
style PA2 fill:#2d333b,stroke:#539bf5,color:#adbac7
style PA3 fill:#2d333b,stroke:#539bf5,color:#adbac7
style PA4 fill:#2d333b,stroke:#e5534b,color:#adbac7
style EMU1 fill:#2d333b,stroke:#57ab5a,color:#adbac7
style EMU2 fill:#2d333b,stroke:#57ab5a,color:#adbac7
style EMU3 fill:#2d333b,stroke:#57ab5a,color:#adbac7
style EMU4 fill:#2d333b,stroke:#57ab5a,color:#adbac7
Figure 2: Comparison of the two identity models. With personal accounts, the account outlives the employment relationship (red border). With EMU, the entire lifecycle is governed by the IdP (green borders), providing full control from provisioning to deprovisioning.
Conditional Access Policy Flow with OIDC
flowchart LR
A[User requests<br/>GitHub access] --> B{OIDC token<br/>valid?}
B -- Yes --> C{Conditional access<br/>policies met?}
B -- No --> D[Redirect to<br/>Entra ID login]
C -- Yes --> E[Access granted]
C -- No --> F{Can user<br/>remediate?}
F -- Yes --> G[Prompt: enroll device,<br/>complete MFA, etc.]
F -- No --> H[Access denied]
G --> B
D --> B
style E fill:#2d333b,stroke:#57ab5a,color:#adbac7
style H fill:#2d333b,stroke:#e5534b,color:#adbac7
Figure 3: Conditional access policy evaluation flow for OIDC-connected EMU enterprises. Unlike SAML, OIDC enables policy evaluation on every token refresh, not just at initial sign-in.
4. Summary
Key Takeaways:
- Enterprise Managed Users (EMU) provides full account lifecycle management through the IdP, while personal accounts with SAML SSO offer flexibility and open source participation on the same identity
- SAML SSO requires configuring matching settings in both Microsoft Entra ID and GitHub: Entity ID, Reply URL, Sign-on URL, and the signing certificate must align exactly
- OIDC authentication for EMU (currently supported only with Microsoft Entra ID) enables real-time conditional access policy enforcement through token-based session validation
- Conditional access policies are the primary mechanism for enforcing device compliance, MFA, and location-based restrictions for GitHub access
- SCIM provisioning is mandatory for EMU and handles automated user creation, attribute synchronization, and deprovisioning when users are removed from the IdP
What's Next: See Chapter 3: SCIM Provisioning for configuring automated user and group provisioning, team synchronization, and handling edge cases in identity lifecycle management.
5. Hands-On Assignment
Prerequisites Check: Before starting this lab, ensure you have completed:
- A working GitHub Enterprise Cloud environment (Chapter 1: Enterprise Subscription & Environment Setup)
- A Microsoft Entra ID tenant (free tier is sufficient)
- GitHub CLI (
gh) installed and authenticated
Lab: Configure SAML SSO for GitHub Enterprise Cloud
Objective: Configure SAML Single Sign-On between Microsoft Entra ID and your GitHub Enterprise Cloud trial organization, test the authentication flow, and enforce SAML for all organization members.
Prerequisites:
- A GitHub Enterprise Cloud trial (created in Chapter 1)
- A Microsoft Entra ID tenant (a free tier tenant is sufficient)
- Cloud Application Administrator (or higher) role in Microsoft Entra ID
- Organization owner role in your GitHub organization
- GitHub CLI (
gh) installed (version 2.40 or later)
Assignment:
- Add the GitHub Enterprise Cloud application from the Microsoft Entra ID gallery and configure Basic SAML settings with your organization's Entity ID, Reply URL, and Sign-on URL
- Map the NameID attribute to
user.mailand download the signing certificate - Configure SAML SSO on the GitHub organization side using the Login URL, Issuer, and certificate from Entra ID
- Test the SAML configuration from both the Entra ID and GitHub sides
- Enforce SAML SSO for the organization and verify that unauthenticated access is blocked
- Create a basic conditional access policy in Entra ID requiring MFA for the GitHub application (report-only mode)
Expected Outcome: A working SAML SSO integration where organization members authenticate through Microsoft Entra ID. A conditional access policy in report-only mode that would require MFA for GitHub access.
Validation: When accessing https://github.com/orgs/YOUR-ORG/sso, you are redirected to Microsoft Entra ID for authentication. After authenticating, you are returned to GitHub with full organization access. The Entra ID sign-in logs show successful SAML authentication events for the GitHub application.
6. Step-by-Step Walkthrough
This section provides a guided solution for the hands-on assignment above. If you completed the assignment independently, you can skip this section or use it to verify your approach.
Step 1: Add the GitHub Application in Microsoft Entra ID
- Sign in to the Microsoft Entra admin center as a Cloud Application Administrator or higher
- Navigate to Entra ID > Enterprise applications > New application
- In the search box, type GitHub and select GitHub Enterprise Cloud - Organization from the results
- Click Create and wait for the application to be added to your tenant
Verify the application appears in your enterprise applications list:
# Using Azure CLI to verify (optional)
az ad app list --display-name "GitHub" --query "[].{Name:displayName, AppId:appId}" --output table
Step 2: Configure Basic SAML Settings
- In the GitHub enterprise application, navigate to Single sign-on > SAML
- Click the pencil icon on Basic SAML Configuration
- Enter the following values (replace
YOUR-ORGwith your GitHub organization name):
| Field | Value |
|---|---|
| Identifier (Entity ID) | https://github.com/orgs/YOUR-ORG |
| Reply URL (ACS URL) | https://github.com/orgs/YOUR-ORG/saml/consume |
| Sign on URL | https://github.com/orgs/YOUR-ORG/sso |
- Click Save
Step 3: Configure Attribute Mappings
- In the User Attributes & Claims section, click Edit
- Click on the Unique User Identifier (Name ID) claim
- Change the Source attribute from
user.userprincipalnametouser.mail - Ensure the Name identifier format is set to Email address
- Click Save
Verify the following claims are present (add them if missing):
| Claim Name | Source Attribute |
|---|---|
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name | user.userprincipalname |
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress | user.mail |
Step 4: Download the Signing Certificate
- In the SAML Signing Certificate section, find Certificate (Base64)
- Click Download to save the certificate file to your computer
- Also copy the following values from the Set up GitHub section:
- Login URL (e.g.,
https://login.microsoftonline.com/{tenant-id}/saml2) - Azure AD Identifier (e.g.,
https://sts.windows.net/{tenant-id}/) - Logout URL
- Login URL (e.g.,
Step 5: Assign Users to the Application
- Navigate to Users and groups in the GitHub application
- Click Add user/group
- Under Users and groups, select the users or security group that should have GitHub access
- Click Assign
Step 6: Configure SAML SSO on GitHub
- Open a new browser tab and sign in to GitHub as an organization owner
- Navigate to your organization:
https://github.com/orgs/YOUR-ORG - Click Settings > Authentication security
- Check Enable SAML authentication
- Enter the following values:
| GitHub Field | Value from Entra ID |
|---|---|
| Sign on URL | The Login URL copied from Entra ID |
| Issuer | The Azure AD Identifier copied from Entra ID |
| Public certificate | Open the downloaded certificate in a text editor and paste the full contents |
- Set the Signature Method to RSA-SHA256
- Set the Digest Method to SHA256
Step 7: Test the SAML Configuration
- On the GitHub SAML configuration page, click Test SAML configuration
- A new window opens, redirecting you to Microsoft Entra ID
- Authenticate with your Entra ID credentials
- If successful, you see a confirmation message in GitHub
If the test fails, check:
- The certificate was pasted completely (including
-----BEGIN CERTIFICATE-----and-----END CERTIFICATE-----lines) - The Entity ID in Entra ID exactly matches
https://github.com/orgs/YOUR-ORG(no trailing slash) - The NameID attribute maps to an email address that matches a verified email on the GitHub account
Step 8: Save and Enforce SAML SSO
- After a successful test, click Save on the GitHub authentication security page
- To enforce SAML (require all members to authenticate via SAML), check Require SAML SSO authentication for all members of the YOUR-ORG organization
- Click Save
Verify SAML enforcement using the GitHub CLI:
# Check your SAML-linked identity
gh api /orgs/YOUR-ORG/members --jq '.[].login'
# Verify the organization's SSO enforcement
gh api /orgs/YOUR-ORG --jq '{sso: .two_factor_requirement_enabled}'
Step 9: Create a Conditional Access Policy (Report-Only)
- Return to the Microsoft Entra admin center
- Navigate to Entra ID > Conditional Access > Policies > New policy
- Name the policy:
GitHub - Require MFA (Report-Only) - Under Assignments > Users: Select the same group assigned to the GitHub application
- Under Target resources > Cloud apps > Include: Select the GitHub enterprise application
- Under Access controls > Grant: Select Require multifactor authentication
- Set Enable policy to Report-only
- Click Create
Verification
Confirm the full setup by performing a complete authentication cycle:
- Open a private/incognito browser window
- Navigate to
https://github.com/orgs/YOUR-ORG/sso - Verify you are redirected to Microsoft Entra ID
- Authenticate with your credentials (and MFA if prompted)
- Verify you are returned to GitHub with organization access
Check the Entra ID sign-in logs:
- In the Entra admin center, navigate to Entra ID > Sign-in logs
- Filter by Application = your GitHub application
- Verify a successful sign-in event with Authentication method = SAML
# Verify your SAML identity is linked
gh api /user --jq '{login: .login, email: .email}'
7. Q&A -- Chapter Review
Instructions: Select the best answer for each question. Answers and explanations follow after all questions.
Question 1
A 200-developer enterprise needs to ensure that when an employee is terminated, their GitHub access is revoked immediately and their account cannot be reused. Which identity model should they choose?
- A) Personal accounts with SAML SSO enforced at the organization level
- B) Personal accounts with SAML SSO enforced at the enterprise level
- C) Enterprise Managed Users (EMU) with OIDC authentication
- D) GitHub's built-in username/password authentication with 2FA
Question 2
When configuring SAML SSO for a GitHub Enterprise Cloud organization in Microsoft Entra ID, which attribute should the Unique User Identifier (Name ID) be mapped to?
- A)
user.objectid - B)
user.userprincipalname - C)
user.mail - D)
user.displayname
Question 3
What is the primary advantage of OIDC over SAML for Enterprise Managed Users authentication?
- A) OIDC supports more identity providers than SAML
- B) OIDC enables real-time conditional access policy enforcement through token validation
- C) OIDC does not require SCIM provisioning
- D) OIDC eliminates the need for multi-factor authentication
Question 4
An EMU enterprise uses SAML with Microsoft Entra ID. A developer's device falls out of compliance with the organization's Intune policy at 10:00 AM, but the developer's SAML session does not expire until 6:00 PM. What happens?
- A) The developer is immediately blocked from GitHub
- B) The developer continues to access GitHub until the SAML session expires at 6:00 PM
- C) GitHub automatically checks device compliance every 15 minutes
- D) The developer's EMU account is suspended by SCIM
Question 5
Which of the following is a valid Reply URL (Assertion Consumer Service URL) for an enterprise-level SAML configuration on GitHub?
- A)
https://github.com/enterprises/contoso/saml/login - B)
https://github.com/enterprises/contoso/saml/consume - C)
https://github.com/enterprises/contoso/sso - D)
https://github.com/saml/contoso/callback
Question 6
In the Enterprise Managed Users model, what happens to a user's GitHub account when they are removed from the identity provider?
- A) The account is converted to a personal GitHub account
- B) The account remains active but loses organization membership
- C) The account is suspended and can no longer access enterprise resources
- D) The account is permanently deleted along with all contributions
Question 7
A security team wants to restrict GitHub access to users connecting from approved corporate network locations only. Which mechanism should they use?
- A) GitHub IP allow lists configured at the organization level
- B) Microsoft Entra ID conditional access policy with named locations
- C) GitHub repository branch protection rules
- D) SSH key restrictions in the enterprise settings
Question 8
What provisioning protocol is mandatory for Enterprise Managed Users (EMU) to manage user lifecycle?
- A) SAML Just-in-Time (JIT) provisioning
- B) LDAP synchronization
- C) System for Cross-domain Identity Management (SCIM)
- D) OAuth 2.0 device authorization
Question 9
An organization has SAML SSO enabled but not enforced. Which statement is true?
- A) All organization members must authenticate via SAML before accessing any resources
- B) Members can access the organization without SAML authentication, but linking a SAML identity is optional
- C) SAML SSO has no effect unless it is enforced
- D) Only organization owners need to authenticate via SAML
Question 10
Which Microsoft Entra ID role is the minimum required to configure a SAML SSO enterprise application for GitHub?
- A) Global Administrator
- B) Cloud Application Administrator
- C) Security Administrator
- D) User Administrator
Answer Key
| Q | Answer | Explanation |
|---|---|---|
| 1 | C | Enterprise Managed Users with OIDC provides full account lifecycle management. When a user is removed from the IdP, SCIM deprovisions their EMU account, and OIDC token validation ensures immediate access revocation. Personal accounts (options A and B) persist after the user leaves the organization. |
| 2 | C | GitHub expects the Name ID to be mapped to user.mail so it can match against the user's verified email address on GitHub. Using user.userprincipalname often causes mismatches because the UPN format may differ from the user's email. |
| 3 | B | OIDC's primary advantage for EMU is native conditional access policy enforcement. With OIDC, Microsoft Entra ID evaluates conditional access policies on each token refresh, enabling real-time blocking when compliance conditions are no longer met. SAML evaluates policies only at initial authentication. |
| 4 | B | With SAML, conditional access policies are evaluated only at the point of authentication. Once a SAML session is established, the user retains access until the session expires, even if their device compliance state changes. This is a key reason enterprises with strict compliance requirements choose OIDC over SAML for EMU. |
| 5 | B | The Reply URL (ACS URL) for enterprise-level SAML follows the pattern https://github.com/enterprises/{slug}/saml/consume. Option C is the Sign-on URL, not the Reply URL. Options A and D use incorrect URL patterns. |
| 6 | C | When a user is removed from the IdP, SCIM deprovisioning suspends the EMU account. The account is not deleted (preserving audit history and contribution records) but is fully blocked from accessing enterprise resources. |
| 7 | B | Microsoft Entra ID conditional access policies with named locations allow administrators to restrict access to specific network ranges or geographic locations. This approach centralizes network-based access control at the IdP level, applying consistently across all Entra ID-integrated applications including GitHub. |
| 8 | C | SCIM provisioning is mandatory for EMU. It handles the complete user lifecycle: creating accounts when users are assigned in the IdP, synchronizing attribute changes, and suspending accounts when users are removed. SAML JIT provisioning is not used with EMU. |
| 9 | B | When SAML SSO is enabled but not enforced, members can access the organization without SAML authentication. Linking a SAML identity is optional. Once enforced, all members must authenticate via SAML to access organization resources. |
| 10 | B | Cloud Application Administrator is the minimum Entra ID role required to add gallery applications and configure SAML SSO settings. Global Administrator also works but violates the principle of least privilege. Security Administrator and User Administrator do not have the necessary permissions for enterprise application configuration. |