|
| 1 | +--- |
| 2 | +title: Setting up a self-serve process for GitHub Copilot licenses |
| 3 | +shortTitle: Self-serve licenses |
| 4 | +intro: 'Learn how users can request a license and receive access immediately.' |
| 5 | +versions: |
| 6 | + feature: copilot |
| 7 | +topics: |
| 8 | + - Copilot |
| 9 | +--- |
| 10 | + |
| 11 | +When you've enabled {% data variables.product.prodname_copilot %} in an organization or enterprise, you can set up a self-serve workflow to allow users to request licenses. This allows you to allocate licenses to people who want them, and means people can get started with {% data variables.product.prodname_copilot_short %} quickly. |
| 12 | + |
| 13 | +{% data variables.product.company_short %} has found that many successful rollouts offer a fully self-service model where developers can claim a license without approval. |
| 14 | + |
| 15 | +This article outlines two approaches your company can take: |
| 16 | + |
| 17 | +* {% data variables.product.github %}'s **request access** feature for {% data variables.product.prodname_copilot_business_short %}, which requires no setup but does require explicit approvals from an administrator |
| 18 | +* Your own integration with **{% data variables.product.github %}'s API**, which allows you to create your own process with instant access |
| 19 | + |
| 20 | +## Approach 1: Use {% data variables.product.github %}'s "request access" feature |
| 21 | + |
| 22 | +If you have a {% data variables.product.prodname_copilot_business_short %} subscription, members of an organization can request access to {% data variables.product.prodname_copilot %} on their settings page. Then, an organization owner must review and approve each request. |
| 23 | + |
| 24 | +The process, which you should **communicate with users**, is as follows. |
| 25 | + |
| 26 | +1. An organization or enterprise owner ensures {% data variables.product.prodname_copilot_business_short %} is enabled in the organization where you want to manage access. |
| 27 | +1. Members of the organization go to their personal settings page at https://github.com/settings/copilot and click **Ask admin for access**. |
| 28 | +1. An organization owner reviews and approves requests on the "Requests from members" page in the organization. See [AUTOTITLE](/copilot/managing-copilot/managing-github-copilot-in-your-organization/managing-access-to-github-copilot-in-your-organization/managing-requests-for-copilot-business-in-your-organization). |
| 29 | + |
| 30 | +You should set up a process where requests are reviewed regularly, so that interested users can get access to {% data variables.product.prodname_copilot_short %} quickly. |
| 31 | + |
| 32 | +Users can also request access from organizations where {% data variables.product.prodname_copilot_business_short %} is not enabled. In this case, organization owners will be prompted to ask an enterprise owner to enable {% data variables.product.prodname_copilot_short %} for the organization. |
| 33 | + |
| 34 | +## Approach 2: Integrate with the API |
| 35 | + |
| 36 | +For a more streamlined approach, you can set up a self-serve process by integrating with {% data variables.product.github %}'s API. The benefits of this approach are that it allows you to build the process into your existing tooling, and it gives you the option to allow users to receive access instantly, without a manual approval process. |
| 37 | + |
| 38 | +To set up the integration, you will use the [Add users to the {% data variables.product.prodname_copilot_short %} subscription for an organization](/rest/copilot/copilot-user-management#add-users-to-the-copilot-subscription-for-an-organization) endpoint, providing the username of the user who has requested access. |
| 39 | + |
| 40 | +For example, the API call in a {% data variables.product.prodname_actions %} workflow might look as follows, where the organization and selected usernames are provided by the context of the workflow trigger: |
| 41 | + |
| 42 | +``` javascript |
| 43 | +const { Octokit } = require("@octokit/action"); |
| 44 | +const octokit = new Octokit(); |
| 45 | +const response = await octokit.request('POST /orgs/{org}/copilot/billing/selected_users', { |
| 46 | + org: context.repo.owner, |
| 47 | + selected_usernames: [context.payload.sender.login], |
| 48 | + headers: { |
| 49 | + 'X-GitHub-Api-Version': '2022-11-28' |
| 50 | + } |
| 51 | +}) |
| 52 | +``` |
| 53 | + |
| 54 | +>[!NOTE] This endpoint only works if you use organizations on {% data variables.product.github %}. If {% data variables.product.company_short %} has provided you with a **dedicated enterprise for managing {% data variables.product.prodname_copilot_business_short %} licenses**, you will need to add users to enterprise teams instead. To request API documentation, please contact your account manager. |
| 55 | +
|
| 56 | +### Example implementations |
| 57 | + |
| 58 | +* You could create the process entirely within {% data variables.product.github %}, having users create issues to request access, then using a {% data variables.product.prodname_actions %} workflow to call the API. For a demo of this approach, see the [microsoft/GitHubCopilotLicenseAssignment](https://github.com/microsoft/GitHubCopilotLicenseAssignment) repository. Note that this is **an external example that isn't covered by {% data variables.contact.github_support %}**. |
| 59 | +* You could add a "Request access" button to users' profiles on your company's internal website, which will pass the user's {% data variables.product.github %} username to the API. You could grant access instantly or validate the user first, such as checking for their membership of a certain team. |
| 60 | + |
| 61 | +## Further reading |
| 62 | + |
| 63 | +* [AUTOTITLE](/copilot/rolling-out-github-copilot-at-scale/driving-copilot-adoption-in-your-company) |
| 64 | +* [AUTOTITLE](/copilot/rolling-out-github-copilot-at-scale/reminding-inactive-users) |
| 65 | +* [AUTOTITLE](/copilot/rolling-out-github-copilot-at-scale/analyzing-usage-over-time-with-the-copilot-metrics-api) |
| 66 | +* [AUTOTITLE](/enterprise-cloud@latest/admin/managing-accounts-and-repositories/managing-organizations-in-your-enterprise/managing-requests-for-copilot-business-from-organizations-in-your-enterprise){% ifversion fpt %} in the {% data variables.product.prodname_ghe_cloud %} documentation{% endif %} |
0 commit comments