|
| 1 | +# Set up Authentication in Azure Container App |
| 2 | + |
| 3 | +This document provides step-by-step instructions to configure Azure App Registrations for a front-end and back-end application. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | +- Access to **Azure Active Directory (Azure AD)** |
| 7 | +- Necessary permissions to create and manage **App Registrations** |
| 8 | + |
| 9 | +## Step 1: Add Authentication Provider |
| 10 | +We will add Microsoft Entra ID as an authentication provider to API and Web Application. |
| 11 | + |
| 12 | +1. Add Authentication Provider in Web Application |
| 13 | + |
| 14 | + - Go to deployed Container App and select ca-< your environment >-< randomname >-web and click **Add Identity Provider** button in Authentication |
| 15 | + |
| 16 | + |
| 17 | + - Select **Microsoft** and set **Client secret expiration** then Click **Add** button |
| 18 | + |
| 19 | + |
| 20 | +2. Add Authentication Provider in API Service |
| 21 | + |
| 22 | + - Go to deployed Container App and select **ca-< your environment >-< randomname >-api** and click **Add Identity Provider** button in Authentication |
| 23 | + |
| 24 | + |
| 25 | + - Select **Microsoft** and set **Client secret expiration** |
| 26 | + |
| 27 | + |
| 28 | + - Set **Unauthenticated requests** then Click **Add** button |
| 29 | + |
| 30 | + |
| 31 | +## Step 2: Configure Application Registration - Web Application |
| 32 | +1. Set Redirect URI in Single Page Application Platform |
| 33 | + - Go to deployed Container App **ca-< your environment >-< randomname >-web** and select **Authentication** menu then select created Application Registration |
| 34 | + |
| 35 | + |
| 36 | + - Select **Authentication** then Select **+ Add a platform** menu |
| 37 | + |
| 38 | + |
| 39 | + - Select **Single-page application** |
| 40 | + |
| 41 | + |
| 42 | + - Add Container App **ca-< your environment >-< randomname >-web**'s URL |
| 43 | + |
| 44 | + - You may get this URL from here in your Container App |
| 45 | + |
| 46 | + |
| 47 | +2. Add Permission and Grant Permission |
| 48 | + - Add Permission for API application. Select **+ Add a permission** button then search API application with name **ca-< your environment name >-<unique string>-api** |
| 49 | + |
| 50 | + |
| 51 | + - Grant admin consent to permissions |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | +## Step 3: Configure Application Registration - API Application |
| 56 | +Add Web Application Registration's Client Id to API's Allowed client application list. |
| 57 | + |
| 58 | +## Step 4: Update Environment Variable in Container App for Web Application |
| 59 | +Update Environment variable for Client Id in Web App's application registration, Scope for Web as auth scope, Scope for API as token scope |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | +## Conclusion |
| 66 | +You have successfully configured the front-end and back-end Azure App Registrations with proper API permissions and security settings. |
0 commit comments