Configure your App Service or Azure Functions app to login using an OpenID Connect provider
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 specification. OpenID Connect (OIDC) is an industry standard used by many identity providers (IDPs). You do not need to understand the details of the specification in order to configure your app to use an adherent IDP.
You can configure your app to use one or more OIDC providers. Each must be given a unique alphanumeric name in the configuration, and only one can serve as the default redirect target.
Your provider will require you to register the details of your application with it. One of these steps involves specifying a redirect URI. This redirect URI will be of the form
<app-url>/.auth/login/<provider-name>/callback. Each identity provider should provide more instructions on how to complete these steps.
Some providers may require additional steps for their configuration and how to use the values they provide. For example, Apple provides a private key which is not itself used as the OIDC client secret, and you instead must use it craft a JWT which is treated as the secret you provide in your app config (see the "Creating the Client Secret" section of the Sign in with Apple documentation)
You will need to collect a client ID and client secret for your application.
The client secret is an important security credential. Do not share this secret with anyone or distribute it within a client application.
Additionally, you will need the OpenID Connect metadata for the provider. This is often exposed via a configuration metadata document, which is the provider's Issuer URL suffixed with
/.well-known/openid-configuration. Gather this configuration URL.
If you are unable to use a configuration metadata document, you will need to gather the following values separately:
- The issuer URL (sometimes shown as
- The OAuth 2.0 Authorization endpoint (sometimes shown as
- The OAuth 2.0 Token endpoint (sometimes shown as
- The URL of the OAuth 2.0 JSON Web Key Set document (sometimes shown as
- Sign in to the [Azure portal] and navigate to your app.
- Select Authentication in the menu on the left. Click Add identity provider.
- Select OpenID Connect in the identity provider dropdown.
- Provide the unique alphanumeric name selected earlier for OpenID provider name.
- If you have the URL for the metadata document from the identity provider, provide that value for Metadata URL. Otherwise, select the Provide endpoints separately option and put each URL gathered from the identity provider in the appropriate field.
- Provide the earlier collected Client ID and Client Secret in the appropriate fields.
- Specify an application setting name for your client secret. Your client secret will be stored as an app setting to ensure secrets are stored in a secure fashion. You can update that setting later to use Key Vault references if you wish to manage the secret in Azure Key Vault.
- Press the Add button to finish setting up the identity provider.
Submit and view feedback for