Rediģēt

Kopīgot, izmantojot


Enable authentication and authorization in Azure Container Apps with Google

This article shows you how to configure Azure Container Apps to use Google as an authentication provider.

To complete the following procedure, you must have a Google account that has a verified email address. To create a new Google account, go to accounts.google.com.

Prerequisites

None

Register your application with Google

Follow these steps:

  1. Follow the Google documentation at Google Sign-In for server-side apps to create a client ID and client secret. There's no need to make any code changes. Just use the following information:

    • For Authorized JavaScript Origins, use https://<hostname>.azurecontainerapps.io with the name of your app in <hostname>.
    • For Authorized Redirect URI, use https://<hostname>.azurecontainerapps.io/.auth/login/google/callback.
  2. Copy the App ID and the App secret values.

    Important

    The App secret is an important security credential. Do not share this secret with anyone or distribute it within a client application.

Add Google information to your application

Follow these steps:

  1. Sign in to the Azure portal and navigate to your app.

  2. Select Authentication in the menu on the left. Select Add identity provider.

  3. Select Google in the identity provider dropdown. Paste in the App ID and App Secret values that you obtained previously.

    The secret will be stored as a secret in your container app.

  4. If you're configuring the first identity provider for this application, you'll also be prompted with a Container Apps authentication settings section. Otherwise, you may move on to the next step.

    These options determine how your application responds to unauthenticated requests. The default selections redirect all requests to sign 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.

  5. Select Add.

    Note

    For adding scope: You can define what permissions your application has in the provider's registration portal. The app can request scopes at login time which leverage these permissions.

    You're now ready to use Google for authentication in your app. The provider will be listed on the Authentication screen. From there, you can edit or delete this provider configuration.

Working with authenticated users

Use the following guides for details on working with authenticated users.