Configure your App Service or Azure Functions app to sign in 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 don't 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.
Register your application with the identity provider
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. <provider-name>
will refer to the friendly name you give to the OpenID provider name in Azure.
Note
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 to 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'll need to collect a client ID and client secret for your application.
Important
The client secret is an important security credential. Don't share this secret with anyone or distribute it within a client application.
Additionally, you'll 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're unable to use a configuration metadata document, you'll need to gather the following values separately:
- The issuer URL (sometimes shown as
issuer
) - The OAuth 2.0 Authorization endpoint (sometimes shown as
authorization_endpoint
) - The OAuth 2.0 Token endpoint (sometimes shown as
token_endpoint
) - The URL of the OAuth 2.0 JSON Web Key Set document (sometimes shown as
jwks_uri
)
Note
The OpenID provider name can't contain symbols like "-" because an appsetting will be created based on this and it doesn't support it. Use "_" instead.
Note
Azure requires "openid," "profile," and "email" scopes. Make sure you've configured your App Registration in your ID Provider with at least these scopes.