Skip to content

Commit 001bc8b

Browse files
authored
Merge pull request #190163 from mattchenderson/ghidp
adding github identity provider to app service
2 parents 170d66d + 81b3c5b commit 001bc8b

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
title: Configure GitHub authentication
3+
description: Learn how to configure GitHub authentication as an identity provider for your App Service or Azure Functions app.
4+
ms.topic: article
5+
ms.date: 03/01/2022
6+
---
7+
8+
# Configure your App Service or Azure Functions app to use GitHub login
9+
10+
[!INCLUDE [app-service-mobile-selector-authentication](../../includes/app-service-mobile-selector-authentication.md)]
11+
12+
This article shows how to configure Azure App Service or Azure Functions to use GitHub as an authentication provider.
13+
14+
To complete the procedure in this article, you need a GitHub account. To create a new GitHub account, go to [GitHub].
15+
16+
## <a name="register"> </a>Register your application with GitHub
17+
18+
1. Sign in to the [Azure portal] and go to your application. Copy your **URL**. You'll use it to configure your GitHub app.
19+
1. Follow the instructions for [creating an OAuth app on GitHub](https://docs.github.com/developers/apps/building-oauth-apps/creating-an-oauth-app). In the **Authorization callback URL** section, enter the HTTPS URL of your app and append the path `/.auth/login/github/callback`. For example, `https://contoso.azurewebsites.net/.auth/login/github/callback`.
20+
1. On the application page, make note of the **Client ID**, which you will need later.
21+
1. Under **Client Secrets**, select **Generate a new client secret**.
22+
1. Make note of the client secret value, which you will need later.
23+
24+
> [!IMPORTANT]
25+
> The client secret is an important security credential. Do not share this secret with anyone or distribute it with your app.
26+
27+
## <a name="secrets"> </a>Add GitHub information to your application
28+
29+
1. Sign in to the [Azure portal] and navigate to your app.
30+
1. Select **Authentication** in the menu on the left. Click **Add identity provider**.
31+
1. Select **GitHub** in the identity provider dropdown. Paste in the `Client ID` and `Client secret` values that you obtained previously.
32+
33+
The secret will be stored as a slot-sticky [application setting](./configure-common.md#configure-app-settings) named `GITHUB_PROVIDER_AUTHENTICATION_SECRET`. You can update that setting later to use [Key Vault references](./app-service-key-vault-references.md) if you wish to manage the secret in Azure Key Vault.
34+
35+
1. If this is the first identity provider configured for the application, you will also be prompted with an **App Service authentication settings** section. Otherwise, you may move on to the next step.
36+
37+
These options determine how your application responds to unauthenticated requests, and the default selections will redirect all requests to log in with this new provider. You can change customize this behavior now or adjust these settings later from the main **Authentication** screen by choosing **Edit** next to **Authentication settings**. To learn more about these options, see [Authentication flow](overview-authentication-authorization.md#authentication-flow).
38+
39+
1. Click **Add**.
40+
41+
You're now ready to use GitHub for authentication in your app. The provider will be listed on the **Authentication** screen. From there, you can edit or delete this provider configuration.
42+
43+
<!-- URLs. -->
44+
45+
[GitHub]:https://github.com/
46+
[Azure portal]: https://portal.azure.com/

articles/app-service/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@
255255
href: configure-authentication-provider-aad.md
256256
- name: Authenticate with Facebook
257257
href: configure-authentication-provider-facebook.md
258+
- name: Authenticate with GitHub
259+
href: configure-authentication-provider-github.md
258260
- name: Authenticate with Google
259261
href: configure-authentication-provider-google.md
260262
- name: Authenticate with Twitter

articles/azure-functions/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,8 @@
429429
href: ../app-service/configure-authentication-provider-aad.md?toc=%2fazure%2fazure-functions%2ftoc.json
430430
- name: Authenticate with Facebook
431431
href: ../app-service/configure-authentication-provider-facebook.md?toc=%2fazure%2fazure-functions%2ftoc.json
432+
- name: Authenticate with GitHub
433+
href: ../app-service/configure-authentication-provider-github.md?toc=%2fazure%2fazure-functions%2ftoc.json
432434
- name: Authenticate with Google
433435
href: ../app-service/configure-authentication-provider-google.md?toc=%2fazure%2fazure-functions%2ftoc.json
434436
- name: Authenticate with Twitter

0 commit comments

Comments
 (0)