|
2 | 2 | title: Configure an OpenID Connect Provider |
3 | 3 | description: Learn how to configure an OpenID Connect provider as an identity provider for your App Service or Azure Functions app. |
4 | 4 | ms.topic: how-to |
5 | | -ms.date: 04/02/2025 |
| 5 | +ms.date: 07/08/2025 |
6 | 6 | ms.reviewer: mahender |
7 | 7 | ms.custom: AppServiceIdentity |
8 | 8 | author: cephalin |
9 | 9 | ms.author: cephalin |
10 | 10 | #customer intent: As an app developer, I want to use a custom authentication provider that uses the OpenID Connect specification in Azure App Service. |
11 | 11 | --- |
12 | 12 |
|
13 | | -# Configure your App Service or Azure Functions app to sign in by using an OpenID Connect provider |
| 13 | +# Configure your App Service or Azure Functions app to use an OpenID Connect provider |
14 | 14 |
|
15 | 15 | [!INCLUDE [app-service-mobile-selector-authentication](../../includes/app-service-mobile-selector-authentication.md)] |
16 | 16 |
|
17 | | -This article shows you how to configure Azure App Service or Azure Functions to use a custom authentication provider that adheres to the [OpenID Connect (OIDC) specification](https://openid.net/connect/). OIDC is an industry standard that many identity providers (IDPs) use. You don't need to understand the details of the specification for your app to use an OIDC identity provider. |
| 17 | +This article shows you how to configure Azure App Service or Azure Functions to use a custom authentication provider that adheres to the [OpenID Connect (OIDC) specification](https://openid.net/connect/). OIDC is an industry standard that many identity providers use. You don't need to understand the details of the specification for your app to use an OIDC identity provider. |
18 | 18 |
|
19 | | -You can configure your app to use one or more OIDC providers. Each provider must have a unique alphanumeric name in the configuration. Only one provider can serve as the default redirect target. |
| 19 | +You can configure your app to use one or more OIDC providers. You must give each OIDC provider a unique friendly name in the configuration. Only one provider can serve as the default redirect target. |
20 | 20 |
|
21 | | -## <a name="register"> </a>Register your application with the identity provider |
| 21 | +## <a name="register"> </a>Register your app with the OIDC identity provider |
22 | 22 |
|
23 | | -Your provider requires you to register the details of your application with it. One of these steps involves specifying a redirect URI that has the form `<app-url>/.auth/login/<provider-name>/callback`. Each identity provider should provide more instructions on how to complete the steps. The `<provider-name>` value refers to the friendly name that you give to the OpenID provider name in Azure. |
| 23 | +Your provider requires you to register your application by specifying a redirect URI in the form `<app-url>/.auth/login/<provider-name>/callback`. The `<provider-name>` is a friendly name you give the OpenID provider in Azure. |
24 | 24 |
|
25 | 25 | > [!NOTE] |
26 | | -> Some providers might require extra steps for their configuration and for using the values that they provide. For example, Apple provides a private key that isn't itself used as the OIDC client secret. You use it to create a JSON Web Token (JWT). You use the web token as the secret that you provide in your app configuration. For more information, see [Creating a client secret](https://developer.apple.com/documentation/sign_in_with_apple/generate_and_validate_tokens). |
| 26 | +> The OpenID provider name can't contain a hyphen `-`, because an App Service application setting is created based on this name, and application settings don't support hyphens. You can use an underscore `_` instead. |
27 | 27 |
|
28 | | -You need to collect a *client ID* and a *client secret* for your application. The client secret is an important security credential. Don't share this secret with anyone or distribute it in a client application. |
| 28 | +You need to collect a *client ID* for your application. You also need to provide a *client secret* if you want the user to acquire access tokens using the interactive authorization code flow. If you don't want to acquire access tokens, you don't need to use a secret. |
29 | 29 |
|
30 | | -> [!NOTE] |
31 | | -> You only need to provide a client secret to the configuration if you would like to acquire access tokens for the user through interactive login flow using the authorization code flow. If this is not your case, collecting a secret is not required. |
| 30 | +The client secret is an important security credential. Don't share this secret with anyone or distribute it in a client application. |
| 31 | + |
| 32 | +Each identity provider should provide instructions on how to complete the registration steps. Some providers might require extra steps for their configuration and for using the values that they provide. |
32 | 33 |
|
33 | | -You also need the OIDC metadata for the provider. This metadata is often exposed in a [configuration metadata document](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig), which is the provider's issuer URL suffixed with `/.well-known/openid-configuration`. Get this configuration URL. |
| 34 | +For example, Apple provides a private key that you use to create a JSON Web Token (JWT). You provide the JWT as the secret in your app configuration. For more information, see [Creating a client secret](https://developer.apple.com/documentation/sign_in_with_apple/generate_and_validate_tokens). |
| 35 | + |
| 36 | +You also need the OIDC metadata for the provider. This metadata is often exposed in a [configuration metadata document](https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig) that you can get at the path formed by appending `/.well-known/openid-configuration` to the provider's issuer URL. |
34 | 37 |
|
35 | 38 | If you can't use a configuration metadata document, get the following values separately: |
36 | 39 |
|
37 | | -- The issuer URL (sometimes shown as `issuer`) |
38 | | -- The [OAuth 2.0 authorization endpoint](https://tools.ietf.org/html/rfc6749#section-3.1) (sometimes shown as `authorization_endpoint`) |
39 | | -- The [OAuth 2.0 token endpoint](https://tools.ietf.org/html/rfc6749#section-3.2) (sometimes shown as `token_endpoint`) |
40 | | -- The URL of the [OAuth 2.0 JSON Web Key set](https://tools.ietf.org/html/rfc8414#section-2) document (sometimes shown as `jwks_uri`) |
| 40 | +- The issuer URL, sometimes shown as `issuer`. |
| 41 | +- The [OAuth 2.0 authorization endpoint](https://tools.ietf.org/html/rfc6749#section-3.1), sometimes shown as `authorization_endpoint`. |
| 42 | +- The [OAuth 2.0 token endpoint](https://tools.ietf.org/html/rfc6749#section-3.2), sometimes shown as `token_endpoint`. |
| 43 | +- The URL of the [OAuth 2.0 JSON Web Key set](https://tools.ietf.org/html/rfc8414#section-2) document, sometimes shown as `jwks_uri`. |
41 | 44 |
|
42 | 45 | ## <a name="configure"> </a>Add provider information to your application |
43 | 46 |
|
44 | | -To add provider information for your OpenID Connect provider, follow these steps. |
| 47 | +To configure the OpenID Connect provider, follow these steps: |
45 | 48 |
|
46 | | -1. Sign in to the [Azure portal] and go to your app. |
| 49 | +1. On the [Azure portal](https://portal.azure.com) page for your app, select **Authentication** under **Settings** in the left navigation menu. |
47 | 50 |
|
48 | | -1. On the left menu, select **Settings** > **Authentication**. Then select **Add identity provider**. |
| 51 | +1. On the **Authentication** page, select **Add identity provider**, or select **Add provider** in the **Identity provider** section. |
49 | 52 |
|
50 | | -1. For **Identity provider**, select **OpenID Connect**. |
| 53 | +1. On the **Add an identity provider** page, select **OpenID Connect** as the provider. |
51 | 54 |
|
52 | | -1. For **OpenID provider name**, provide the unique alphanumeric name that you selected earlier. |
| 55 | +1. For **OpenID provider name**, enter the friendly name you chose for your OIDC provider. |
53 | 56 |
|
54 | | -1. If you have the URL for the metadata document from the identity provider, provide that value for **Metadata URL**. |
| 57 | +1. Under **OpenID Connect provider configuration**, if you have a metadata document from the identity provider, select **Document URL** for **Metadata entry**. |
55 | 58 |
|
56 | | - Otherwise, select **Provide endpoints separately**. Put each URL from the identity provider in the appropriate field. |
| 59 | + If you don't have a metadata document, select **Enter metadata**, and enter each URL from the identity provider in the appropriate field. |
57 | 60 |
|
58 | | -1. Provide the values that you collected earlier for **Client ID**. If the **Client secret** was also collected, provide it as part of the configuration process. |
| 61 | +1. Under **App registration**, provide the values you collected earlier for **Client ID** and **Client secret**. |
59 | 62 |
|
60 | | -1. Specify an application setting name for your client secret. Your client secret is stored as an app setting to ensure that secrets are stored in a secure fashion. If you want to manage the secret in Azure Key vault, update that setting later to use [Azure Key Vault references](./app-service-key-vault-references.md). |
| 63 | +1. Leave the rest of the settings at their default values, and select **Add** to finish setting up the identity provider. |
61 | 64 |
|
62 | | -1. Select **Add** to finish setting up the identity provider. |
| 65 | +Your client secret is stored as an application setting to ensure that it's stored securely. If you want to manage the secret in Azure Key vault, update the setting later to use [Azure Key Vault references](app-service-key-vault-references.md). |
63 | 66 |
|
64 | | -> [!NOTE] |
65 | | -> The OpenID provider name can't contain a hyphen (-) because an app setting is created based on this name. The app setting doesn't support hyphens. Use an underscore (_) instead. |
| 67 | +>[!NOTE] |
| 68 | +>To add scopes, define the permissions your application has in the provider's registration portal. The app can request scopes that use these permissions at sign-in time. |
66 | 69 | > |
67 | | -> It also requires that the `aud` scope in your token be the same as the **Client Id** as configured above. It is currently not possible to configure the allowed audiences for this provider at the moment. |
| 70 | +>Azure requires `openid`, `profile`, and `email` scopes. Make sure that you configure your app registration in your ID provider with at least these scopes. |
68 | 71 | > |
69 | | -> Azure requires `openid`, `profile`, and `email` scopes. Make sure that you configure your app registration in your ID provider with at least these scopes. |
| 72 | +>The `aud` scope must be the same as the configured **Client Id**. You can't configure the allowed audiences for this provider. |
70 | 73 |
|
71 | 74 | ## <a name="related-content"> </a>Related content |
72 | 75 |
|
73 | 76 | [!INCLUDE [app-service-mobile-related-content-get-started-users](../../includes/app-service-mobile-related-content-get-started-users.md)] |
74 | 77 |
|
75 | | -[Azure portal]: https://portal.azure.com |
|
0 commit comments