Overview
This article walks through restricting GitHub Enterprise Cloud access to one or more approved IP addresses using Conditional Access in Microsoft Entra ID. This ensures that
access to your organization's repositories, code, and resources is limited to sign-ins
originating from your approved corporate network.
The approach uses two components working together:
- Named Locations: A saved list of trusted IP addresses or CIDR ranges defined in
Entra ID. - Conditional Access policy: A policy that blocks GitHub Enterprise Cloud sign-ins originating from
any IP not on the trusted list.
Identify Your Enterprise Type Before Proceeding
GitHub Enterprise Cloud has two distinct account models, and the correct IP restriction
approach depends on which one your organization uses. Check the table below before
continuing.
| Enterprise Type | Authentication Method | IP Restriction Approach |
| Standard Enterprise Cloud (Personal Accounts) |
SAML SSO via Entra ID. Users retain personal GitHub accounts; SSO links them to your enterprise. |
Follow this article. Use the GitHub Enterprise Cloud - Enterprise Account app in Entra ID. |
| Enterprise Managed Users (EMU) + OIDC |
OIDC via Entra ID. Users are fully managed by Entra ID with no personal GitHub identity |
GitHub natively enforces Entra ID Conditional Access IP conditions. Configure Named Locations in Entra ID — no separate CA policy is required. |
| Enterprise Managed Users (EMU) + SAML |
SAML SSO via Entra ID. Users are fully managed by Entra ID. | Follow this article. Use the GitHub Enterprise Managed User app in Entra ID instead of the Enterprise Account app. |
To confirm which type your enterprise uses, sign in to GitHub and check the header bar at
the top of your enterprise view. If it reads "Users managed by [your organization name]",
you are using Enterprise Managed Users. If it shows standard organization navigation, you
are using standard Enterprise Cloud with personal accounts.
Please Note: This article covers Standard Enterprise Cloud (SAML) and EMU + SAML. If your organization uses EMU with OIDC, you do not need to follow this guide — simply configure your IP-based Named Locations in Entra ID and GitHub
will enforce them natively through its Conditional Access Policy (CAP)
support.
Prerequisites
Before proceeding, confirm the following are in place:
- Microsoft Entra ID P1 or P2 license - required for Conditional Access.
- Conditional Access Administrator role or higher in Microsoft Entra ID.
- GitHub Enterprise Cloud plan — SSO is not available on Free or Team plans.
Enterprise Cloud is required. - SAML SSO configured and enforced — the appropriate GitHub enterprise app
must be registered in your Entra ID tenant with SSO active at the enterprise account
level. - Security Defaults Disabled in Entra ID - Security Defaults and Conditional Access cannot run simultaneously.
- Known static IP address - the public IP address or CIDR range of each approved location.
- Break-glass admin account - must be excluded from this policy to prevent administrative lockout.
Important: GitHub Enterprise Cloud SAML SSO does not replace GitHub's own sign in. Members still authenticate with personal GitHub accounts and are
redirected to Entra ID for SAML when accessing organization resources. This means the CA policy blocks SSO-based access from untrusted IPs, but personal access tokens (PATs) and SSH keys authorized for SSO may still allow some access. For full enforcement, configure GitHub's native IP allow list alongside this policy.
Step 1: Create a Named Location for Your Trusted IP(s)
A Named Location defines the trusted IP addresses that Entra ID will reference as a condition in the policy.
- Sign in to the Microsoft Entra admin center at entra.microsoft.com
- Navigate to Protection > Conditional Access > Named locations.
- Select + IP ranges locations.
- Name the location. For example: Trusted - Corporate Office
- Check the Mark as trusted location checkbox.
- Click + and enter your approved IP address or CIDR range.
| Field/Setting | Value/Notes |
| Single IP address | 203.0.113.10/32 |
| IP range (CIDR) | 203.0.113.0/24 |
| Multiple sites | Create a separate Named Location for each site, then reference all of them in the policy. |
7. Click Create.
Step 2: Create the Conditional Access Policy
Create a policy that blocks GitHub Enterprise Cloud access from any location not on your trusted list.
- In the Entra admin center, navigate to Protection > Conditional Access > Policies.
- Select + New policy.
- Name the policy. For example, Block GitHub Enterprise Cloud - Outside Trusted IPs
Assignments: Users
- Under Assignments > Users, select All users.
- Under Exclude, add your break-glass admin account and any automation or service accounts that authenticate from dynamic IPs.
Assignments: Target Resources
- Under Target Resources, select Cloud apps > Select apps.
- Select the app that matches your enterprise setup:
| Field/Setting | Value/Notes |
| Standard Enterprise Cloud | Select GitHub Enterprise Cloud - Enterprise Account |
| EMU + SAML | Select GitHub Enterprise Managed User |
Please Note: If SSO was previously configured at the organization level rather than the enterprise account level, select GitHub Enterprise Cloud - Organization
instead. Organization-level SSO means each organization in your enterprise has a separate app registration — you may need a separate policy per organization, or migrate to enterprise-level SSO for centralized management.
Conditions: Locations
- Under Conditions > Locations, set Configure to Yes.
- Under Include, select Any location.
- Under Exclude, select Selected locations, then choose the Named Location you created in Step 1.
Tip: This configuration reads: Apply this policy to sign-ins from any location except the trusted named location. Any GitHub Enterprise Cloud sign-in originating outside the trusted IP will be blocked before a SAML assertion is issued to GitHub.
Access Controls: Grant
- Under Access Controls > Grant, select Block access.
- Click Select to confirm.
Enable Policy
- Set Enable policy to Report-only.
- Click Create.
Important: Do not set this policy to On immediately. A block policy applied to All users that is misconfigured will prevent all users from authenticating to GitHub Enterprise Cloud. Always validate in Report-only mode first.
Step 3: Validate the Policy
Before enabling enforcement, confirm the policy is evaluating sign-ins correctly.
1. In the Entra admin center, navigate to Identity > Monitoring & health > Sign-in logs.
2. Filter by the GitHub Enterprise Cloud application.
3. Open a sign-in from a user on your trusted IP and confirm the Conditional Access
tab shows Would succeed.
4. If available, review a sign-in from an untrusted IP and confirm it shows Would fail
with the location condition listed as the reason.
5. Investigate any unexpected Would fail entries — this typically indicates the network
is presenting a different egress IP than what is entered in the Named Location.
Tip: Use the What If tool under Protection > Conditional Access to simulate how a specific user signing in from a specific IP would be evaluated without waiting for a real sign-in event.
Step 4: Enable the Policy
- In the Entra admin center, navigate to Protection > Conditional Access > Policies.
- Select the policy created in Step 2.
- Change Enable policy from Report-only to On.
- Click Save.
From this point forward, any GitHub Enterprise Cloud sign-in attempt from an IP address not included in your Named Location will be blocked. Entra ID will not issue a SAML assertion to GitHub, and the user will not be able to access enterprise resources.
Please Note: For complete IP enforcement, also configure GitHub's native IP allow list under your enterprise or organization settings. This covers access methods
that do not go through Entra ID SSO, such as personal access tokens and SSH keys. Navigate to GitHub > Enterprise Settings > Security > IP allow list to enable this.
Summary
The following table summarizes the full configuration process.
| Step | Action |
| Prerequisites | Confirm enterprise type, license, SAML SSO enforced, Security Defaults disabled, static IP(s) identified |
| Step 1 | Create a Named Location with your trusted IP address(es) in Entra ID |
| Step 2 | Create a CA policy targeting the correct GitHub Enterprise Cloud, excluding the Named Location, with Block access |
| Step 3 | Validate in Report-only mode using sign-in logs and the What If tool |
| Step 4 | Switch Enable policy to On and configure GitHub native IP allow list for full coverage. |
Help Center