Note
SCIM for GitHub Enterprise Server is currently in beta and subject to change. GitHub recommends testing with a staging instance first. See Setting up a staging instance.
About SCIM provisioning on GitHub Enterprise Server
To provision and maintain user accounts using SCIM, your identity management system must offer the following functionality:
- Single sign-on authentication implementing Security Assertion Markup Language (SAML) 2.0
- User lifecycle management with System for Cross-domain Identity Management (SCIM)
When you configure authentication and provisioning for your enterprise, you can either use a partner IdP, or you can use another combination of identity management systems.
Using a partner identity provider
Each partner IdP provides a "paved-path" application, which implements both SSO and user lifecycle management. To simplify configuration, GitHub recommends that you use a partner IdP's application for both authentication and provisioning. For more information and a list of partner IdPs, see About user provisioning with SCIM on GitHub Enterprise Server.
For more information about configuring SCIM provisioning using a partner IdP, see Configuring SCIM provisioning to manage users.
Using other identity management systems
If you cannot use a partner IdP for both authentication and provisioning due to migration overhead, licensing costs, or organizational inertia, you can use another identity management system or combination of systems. The systems must provide authentication using SAML and user lifecycle management using SCIM, and must adhere to GitHub's integration guidelines.
GitHub has not tested integration with every identity management system. While integration with GitHub Enterprise Server may be possible, GitHub's support team may not be able to assist you with issues related to these systems. If you need help with an identity management system that's not a partner IdP, or if you use a partner IdP only for SAML authentication, you must consult the system's documentation, support team, or other resources.
Prerequisites
To implement SCIM using the REST API, the general prerequisites for using SCIM on GitHub Enterprise Server apply. See the "Prerequisites" section in Configuring SCIM provisioning to manage users.
In addition, the following prerequisites apply:
-
You must have completed steps 1 to 3 in Configuring SCIM provisioning to manage users.
- You must use the personal access token (classic) created for the built-in setup user to authenticate requests to the REST API.
-
To provision users and groups with GitHub's REST API, your identity management system must support the SCIM 2.0 standard. For more information, see the following RFCs on the IETF website.
-
The user records for the systems that you use for authentication and provisioning must share a unique identifier and satisfy GitHub's matching criteria. For more information, see REST API endpoints for SCIM in the REST API documentation.
Best practices for SCIM provisioning with GitHub's REST API
When you configure your identity management system to provision users or groups of users on GitHub Enterprise Server, GitHub strongly recommends that you adhere to the following guidelines.
- Ensure your identity management system is the only source of write operations
- Send valid requests to REST API endpoints
- Provision users before you provision groups
- Validate access for groups on GitHub
- Understand rate limits on GitHub
- Configure audit log streaming
- Limit the scope of the SCIM token
Ensure your identity management system is the only source of write operations
To ensure that your environment has a single source of truth, you should only programmatically write to the REST API for SCIM provisioning from your identity management system. GitHub strongly recommends that only one system sends POST
, PUT
, PATCH
, or DELETE
requests to the API.
However, you can safely retrieve information from GitHub's APIs with GET
requests in scripts or ad hoc requests by an enterprise owner.
Warning
If you use a partner IdP for SCIM provisioning, the application on the IdP must be the only system that makes write requests to the API. If you make ad hoc requests using the POST
, PUT
, PATCH
, or DELETE
methods, subsequent synchronization attempts will fail, and provisioning won't function properly for your enterprise.
Send valid requests to REST API endpoints
GitHub's REST API endpoints for provisioning users with SCIM require well-formed requests. Bear in mind the following guidelines:
- Requests that don't match the API's expectations will return a
400 Bad Request
error. - REST API endpoints for provisioning users with SCIM require a
User-Agent
header. GitHub Enterprise Server will reject requests without this header.
Provision users before you provision groups
SCIM groups are effective for the management of user access at scale. For example, you can use groups on your identity management system to manage team and organization membership on GitHub Enterprise Server.
To manage team membership with groups on your identity management system, you must sequentially complete the following steps:
- Provision user accounts on GitHub Enterprise Server.
- Provision a group on GitHub Enterprise Server.
- Update the membership of the group on your identity management system.
- Create a team on GitHub Enterprise Server that's mapped to the group on your identity management system.
Validate access for groups on GitHub
If you manage access using groups on your identity management system, you can validate that users get the access you intend. You can use the REST API to compare your system's group memberships with GitHub's understanding of those groups. For more information, see REST API endpoints for external groups and REST API endpoints for teams in the REST API documentation.
Understand rate limits on GitHub
If a site administrator has enabled rate limits on your instance, you may encounter errors when you provision users for the first time. You can review your IdP logs to confirm if attempted SCIM provisioning or push operations failed due to a rate limit error. The response to a failed provisioning attempt will depend on the IdP.
For more information, see Rate limits for the REST API.
Configure audit log streaming
The audit log for your enterprise displays details about activity in your enterprise. You can use the audit log to support your configuration of SCIM. For more information, see About the audit log for your enterprise.
Due to the volume of events in this log, GitHub retains the data for 180 days. To ensure that you don't lose audit log data, and to view more granular activity in the audit log, GitHub recommends that you configure audit log streaming. When you stream the audit log, you can optionally choose to stream events for API requests, including requests to REST API endpoints for SCIM provisioning. For more information, see Streaming the audit log for your enterprise.
Limit the scope of the SCIM token
For a better security posture, we recommend using a personal access token (classic) with only the scim:enterprise
scope to limit the token's access to the REST API endpoints required to make SCIM calls.
If you currently use a token with the admin:enterprise
scope, be aware that this token grants access to all actions on the enterprise. You can swap your token for a new token with just the scim:enterprise
scope without disruption.
Provisioning users with the REST API
To provision, list, or manage users, make requests to the following REST API endpoints. You can read about the associated API endpoints in the REST API documentation and see code examples, and you can review audit log events associated with each request.
Before a person with an identity on your identity management system can sign in to your enterprise, you must create the corresponding user. Your enterprise doesn't require an available license to provision a new user account.
- For an overview of the supported attributes for users, see SCIM in the REST API documentation.
- You can view provisioned users in the web UI for GitHub Enterprise Server. For more information, see Viewing people in your enterprise.
Action | Method | Endpoint and more information | Events in the audit log |
---|---|---|---|
List all provisioned users for your enterprise, which includes all users who are soft-deprovisioned by setting active to false . | GET | /scim/v2/Users | N/A |
Create a user. The API's response includes an id field for uniquely identifying the user. | POST | /scim/v2/Users |
|
Retrieve an existing user in your enterprise using the id field from the POST request that you sent to create the user. | GET | / | N/A |
Update all of an existing user's attributes using the id field from the POST request that you sent to create the user. Update active to false to soft-deprovision the user, or true to reactivate the user. For more information, see Soft-deprovisioning users with the REST API and Reactivating users with the REST API. | PUT | / |
|
Update an individual attribute for an existing user using the id field from the POST request that you sent to create the user. Update active to false to soft-deprovision the user, or true to reactivate the user. For more information, see Soft-deprovisioning users with the REST API and Reactivating users with the REST API. | PATCH | / |
|
To completely delete an existing user, you can hard-deprovision the user. After hard-deprovisioning, you cannot reactivate the user, and you must provision the user as a new user. For more information, see Hard-deprovisioning users with the REST API. | DELETE | / |
|
Soft-deprovisioning users with the REST API
To prevent a user from signing in to access your enterprise, you can soft-deprovision the user by sending a PUT
or PATCH
request to update a user's active
field to false
to /scim/v2/Users/{scim_user_id}
. When you soft-deprovision a user, GitHub Enterprise Server obfuscates the user record's login
and email
fields, and the user is suspended.
When you soft-deprovision a user, the external_identity.update
event does not appear in the audit log. The following events appear in the audit log:
user.suspend
user.remove_email
user.rename
external_identity.deprovision
- If the request succeeds,
external_identity.scim_api_success
- If the request fails,
external_identity.scim_api_failure
You can view all suspended users for your enterprise. For more information, see Viewing people in your enterprise.
Reactivating users with the REST API
To allow a soft-deprovisioned user to sign in to access your enterprise, unsuspend the user by sending a PUT
or PATCH
request to /scim/v2/Users/{scim_user_id}
that updates the user's active
field to true
.
When you reactivate a user, the external_identity.update
event does not appear in the audit log. The following events appear in the audit log:
user.unsuspend
user.remove_email
user.rename
external_identity.provision
- If the request succeeds,
external_identity.scim_api_success
- If the request fails,
external_identity.scim_api_failure
Hard-deprovisioning users with the REST API
To completely delete a user, you can hard-deprovision the user by sending a DELETE
request to /scim/v2/Users/{scim_user_id}
. Your enterprise will retain any resources and comments created by the user.
When you hard-deprovision a user, the following events occur:
- The user record's
login
andemail
fields are obfuscated. - The user's display name is set to an empty string.
- GitHub Enterprise Server deletes all of the user's SCIM attributes, emails, SSH keys, personal access tokens, and GPG keys.
- The user's account on GitHub Enterprise Server is suspended, and authentication to sign in to the account will fail.
To reprovision the user, you must use the POST
method to create a new user. The new user can reuse the deprovisioned user's login
. If the email addresses of the hard-deprovisioned user and the new user match, GitHub Enterprise Server will attribute existing Git commits associated with the email address to the new user. Existing resources and comments created by the original user will not be associated with the new user.
Provisioning groups with the REST API
To control access to repositories in your enterprise, you can use groups on your identity management system to control organization and team membership for users in your enterprise. You can read about the associated API endpoints in the REST API documentation and see code examples, and you can review audit log events associated with each request.
While your enterprise doesn't require an available license to provision a new user account, if you provision a group that results in the addition of users to an organization, you must have available licenses for those users.
- For an overview of the supported attributes for groups, see SCIM in the REST API documentation.
- For an overview of audit log events related to groups, see Audit log events for your enterprise.
- You can view provisioned groups in the web UI for GitHub Enterprise Server. For more information, see Managing team memberships with identity provider groups.
Action | Method | Endpoint and more information | Related events in the audit log |
---|---|---|---|
List all groups defined for your enterprise. | GET | /scim/v2/Groups | N/A |
To define a new IdP group for your enterprise, create the group. The API's response includes an id field for uniquely identifying the group. | POST | /scim/v2/Groups |
|
Retrieve an existing group for your enterprise using the id from the POST request that you sent to create the group. | GET | / | N/A |
Update all of the attributes for an existing group. | PUT | / |
|
Update an individual attribute for an existing group. | PATCH | / |
|
Completely delete an existing group. | DELETE | / |
|
Additional audit log events for changes to IdP groups
If you update the members of an existing group using a PUT
or PATCH
request to /scim/v2/Groups/{scim_group_id}
, GitHub Enterprise Server may add the user to the organization or remove the user from the organization depending on the user's current organization membership. If the user is already a member of at least one team in the organization, the user is a member of the organization. If the user is not a member of any teams in the organization, the user may also not already be a member of the organization.
If your request updates a group linked to a team in an organization where a user is not already a member, in addition to external_group.update
, the following events appear in the audit log:
org.add_member
- If the request adds a user to a group that's linked to a team in an organization where the user is not already a member,
org.add_member
- If the request adds the user to a group that's linked to a team in an organization,
team.add_member
If your request updates a group linked to a team in an organization where a user is already a member, in addition to external_group.update
, the following events appear in the audit log:
- If the request removes the user from a group that's linked to a team in an organization, and the team is not the last team in the organization where the user is a member,
team.remove_member
- If the request removes a user from a group that's linked to the last team in an organization where the user is already a member,
org.remove_member
Troubleshooting SCIM provisioning
-
If your requests to the REST API are rate-limited, you can learn more in Understand rate limits on GitHub.
-
If you enable audit log streaming and stream events for API requests, you can review any requests to the REST API endpoints for SCIM provisioning by filtering for events from the
EnterpriseUsersScim
orEnterpriseGroupsScim
controllers. -
If a SCIM request fails and you're unable to determine the cause, check the status of your identity management system to ensure that services were available.
-
If a request to provision a user fails with a
400
error, and the error message in your identity management system's log indicates issues with account ownership or username formatting, review Username considerations for external authentication. -
After successful authentication, GitHub Enterprise Server links the user who authenticated to an identity provisioned by SCIM. The unique identifiers for authentication and provisioning must match. For more information, see REST API endpoints for SCIM.
-
If you manage access using groups on your identity management system, you can troubleshoot using the REST API or web UI for GitHub Enterprise Server.
- You can use the REST API to compare your identity management system's group memberships with GitHub's understanding of those groups. See REST API endpoints for external groups and REST API endpoints for teams.
- For more information about troubleshooting using the web UI, see Troubleshooting team membership with identity provider groups.
For additional troubleshooting suggestions, see Troubleshooting identity and access management for your enterprise.