Skip to content

Commit 65868ce

Browse files
Merge pull request #717 from microsoft/dev
chore: Dev to Main
2 parents cea5548 + 6deb529 commit 65868ce

13 files changed

Lines changed: 6964 additions & 6080 deletions

File tree

‎docs/ConfigureAppAuthentication.md‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,55 @@ This document provides step-by-step instructions to configure Azure App Registra
1515

1616
- Access to **Microsoft Entra ID**
1717
- Necessary permissions to create and manage **App Registrations**
18+
- Azure CLI (`az`) signed in to the deployment subscription (for the automated script)
19+
20+
## Automated configuration (recommended)
21+
22+
Authentication is configured by a standalone script,
23+
[`infra/scripts/configure_app_authentication`](../infra/scripts/configure_app_authentication.ps1),
24+
which you run as a **manual post-deployment step** (it is intentionally not run
25+
during `azd up` provisioning, to avoid deployment failures). Run it immediately
26+
after the post-deployment schema-registration step. The script performs every
27+
step in this document without the manual portal clicks: it creates (or reuses)
28+
the API and Web app registrations, exposes the `user_impersonation` scope,
29+
enables Container Apps authentication (the **API is set to return HTTP 401** for
30+
unauthenticated callers — fail closed), allows the Web client on the API, and
31+
updates the Web container environment variables.
32+
33+
Run it from the project root:
34+
35+
```powershell
36+
# PowerShell (Windows)
37+
.\infra\scripts\configure_app_authentication.ps1
38+
```
39+
40+
```bash
41+
# Bash (Linux/macOS/WSL)
42+
bash infra/scripts/configure_app_authentication.sh
43+
```
44+
45+
To reuse existing app registrations instead of creating new ones, pass their
46+
client ids:
47+
48+
```powershell
49+
.\infra\scripts\configure_app_authentication.ps1 -ApiClientId <guid> -WebClientId <guid>
50+
```
51+
52+
> **Permissions:** Creating app registrations and granting admin consent
53+
> requires the **Application Administrator** role (or equivalent). If the script
54+
> cannot grant admin consent automatically it prints a warning; a tenant
55+
> administrator must then consent to the API permission for the Web app. See the
56+
> admin-consent note in [Step 2](#step-2-configure-application-registration---web-application).
57+
58+
> **Web interactive login:** The script configures the Web app's identity
59+
> provider. If your tenant requires a client secret for the browser sign-in
60+
> (authorization-code) flow, add one with
61+
> `az containerapp auth microsoft update --name <web-app> --resource-group <rg> --client-secret <value>`,
62+
> or complete Step 1 for the Web app through the portal. The **API** protection
63+
> (HTTP 401 for unauthenticated callers) does not require a secret.
64+
65+
The remaining sections describe the equivalent **manual portal steps**, kept as
66+
a fallback for environments where the script cannot be run.
1867

1968
## Step 1: Add Authentication Provider
2069

‎docs/DeploymentGuide.md‎

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,12 @@ azd up
331331
.\infra\scripts\post_deployment.ps1
332332
```
333333

334+
> **Note:** Run this schema-registration step **before** configuring
335+
> authentication (next step). At this point the API is still open, so no token
336+
> is required. If you re-run it **after** enabling authentication, the script
337+
> authenticates automatically using the deploying user's token — just ensure
338+
> you are signed in with `az login`.
339+
334340
### 5.2 Schema Registration (Automatic)
335341
336342
> Want to customize the schemas for your own documents? [Learn more about adding your own schemas here.](./CustomizeSchemaData.md)
@@ -391,20 +397,50 @@ Schema registration process completed.
391397
✅ Schema registration complete.
392398
```
393399
394-
### 5.2 Configure Authentication (Required)
400+
### 5.3 Configure Authentication (Required Manual Step)
401+
402+
**This step is mandatory.** Until it is completed the API has external ingress
403+
and is reachable without authentication, so run it immediately after the
404+
post-deployment script. Authentication is configured by a standalone script.
405+
406+
Run the configuration script from the project root:
407+
408+
- For Bash (Linux/macOS/WSL):
409+
410+
```bash
411+
bash infra/scripts/configure_app_authentication.sh
412+
```
413+
414+
- For PowerShell (Windows):
415+
416+
```powershell
417+
.\infra\scripts\configure_app_authentication.ps1
418+
```
419+
420+
This enables Microsoft Entra ID (Easy Auth) on the API and Web container apps and
421+
sets the **API to return HTTP 401** for unauthenticated callers (fail closed).
422+
To reuse existing app registrations, pass their client ids
423+
(`-ApiClientId` / `-WebClientId` in PowerShell). For details, options, the
424+
admin-consent requirement, and the manual portal fallback, see
425+
[App Authentication Configuration](./ConfigureAppAuthentication.md).
395426
396-
**This step is mandatory for application access:**
427+
> **Note:** Allow up to 10 minutes for authentication changes to take effect.
428+
> Creating app registrations and granting admin consent requires the
429+
> **Application Administrator** role; if admin consent cannot be granted
430+
> automatically, a tenant administrator must consent to the API permission for
431+
> the Web app.
397432
398-
1. Follow [App Authentication Configuration](./ConfigureAppAuthentication.md).
399-
2. Wait up to 10 minutes for authentication changes to take effect.
433+
> **Troubleshooting:** If the script fails with an authentication error (e.g.
434+
> `InteractionRequired` / `TokenCreatedWithOutdatedPolicies`), run `az logout`
435+
> then `az login` to refresh your token and re-run the script.
400436
401-
### 5.3 Verify Deployment
437+
### 5.4 Verify Deployment
402438
403439
1. Access your application using the **Web App Endpoint** from the deployment output.
404440
2. Confirm the application loads successfully.
405441
3. Verify you can sign in with your authenticated account.
406442
407-
### 5.4 Test the Application
443+
### 5.5 Test the Application
408444
409445
**Quick Test Steps:**
410446
1. **Download Samples**: Get sample files from the [samples directory](../src/ContentProcessorAPI/samples) — use the `claim_date_of_loss/` or `claim_hail/` folders for auto claim documents.

0 commit comments

Comments
 (0)