Skip to content

Commit 372fe33

Browse files
Tejasri-MicrosoftCopilot
andcommitted
commit
Co-authored-by: Copilot <copilot@github.com>
1 parent fd2e78a commit 372fe33

20 files changed

Lines changed: 1705 additions & 434 deletions

azure.yaml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,3 @@ requiredVersions:
99
metadata:
1010
template: content-processing@1.0
1111
name: content-processinge@1.0
12-
13-
hooks:
14-
postprovision:
15-
posix:
16-
shell: sh
17-
run: sed -i 's/\r$//' ./infra/scripts/post_deployment.sh; bash ./infra/scripts/post_deployment.sh
18-
interactive: true
19-
windows:
20-
shell: pwsh
21-
run: ./infra/scripts/post_deployment.ps1
22-
interactive: true

azure_custom.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,3 @@ services:
6464
registry: ${AZURE_CONTAINER_REGISTRY_ENDPOINT}
6565
remoteBuild: true
6666

67-
hooks:
68-
postprovision:
69-
posix:
70-
shell: sh
71-
run: sed -i 's/\r$//' ./infra/scripts/post_deployment.sh; bash ./infra/scripts/post_deployment.sh
72-
interactive: true
73-
windows:
74-
shell: pwsh
75-
run: ./infra/scripts/post_deployment.ps1
76-
interactive: true

docs/AVMPostDeploymentGuide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ After successfully deploying the Content Processing Solution Accelerator using t
1414
2. **Process sample files** — upload and process sample claim bundles for verification
1515
3. **Configure authentication** — set up app registration for secure access
1616

17-
> **Note:** When deploying via `azd up`, schema registration and sample processing happen automatically through a post-provisioning hook. AVM deployments require the manual steps below.
17+
> **Note:** Post-deployment data setup and authentication are manual steps for both `azd` and AVM deployments. Run the scripts in this guide after infrastructure provisioning.
1818
1919
## Prerequisites
2020

@@ -85,7 +85,7 @@ The workflow for each bundle:
8585

8686
You can perform these steps via the web UI or the API directly. See the [API documentation](./API.md) and [Golden Path Workflows](./GoldenPathWorkflows.md) for details.
8787

88-
> **Note:** When deploying via `azd up`, sample file processing happens automatically as Step 4 of the post-provisioning hook.
88+
> **Note:** In `azd` and AVM flows, sample file processing runs when you execute the post-deployment script manually.
8989
9090
### Step 5: Configure Authentication (Required)
9191

docs/ConfigureAppAuthentication.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
# Set up Authentication in Azure Container App
22

3-
> ### Automatic configuration is now the default
3+
> ### Recommended: run the authentication script first
44
>
5-
> As of the latest release, `azd up` **automatically** performs all of the steps below via the `infra/scripts/configure_auth.{sh,ps1}` post-provisioning hook. You should not need to follow this document in most cases.
5+
> `azd up` no longer runs authentication setup automatically. Run the script below after deployment:
66
>
7-
> See [DeploymentGuide.md § 5.2](./DeploymentGuide.md#52-configure-authentication-automatic) for details, including how to opt out with `azd env set AZURE_SKIP_AUTH_SETUP true`.
7+
> - Windows: `./infra/scripts/configure_auth.ps1`
8+
> - macOS/Linux: `sed -i 's/\r$//' ./infra/scripts/configure_auth.sh && bash ./infra/scripts/configure_auth.sh`
89
>
9-
> Follow the manual steps below **only** if:
10-
> - You set `AZURE_SKIP_AUTH_SETUP=true` before running `azd up`
11-
> - The automatic script reported an error (most commonly: your identity lacks permission to grant admin consent — a tenant admin still has to consent, but the rest of the configuration is already complete)
10+
> See [DeploymentGuide.md § 5.2](./DeploymentGuide.md#52-configure-authentication-manual-script) for details.
11+
>
12+
> Follow the portal/manual steps below if:
1213
> - Your tenant policy prohibits programmatic app registration or secret creation
14+
> - The script reports a permission or policy failure that cannot be resolved in your current identity
1315
1416
This document provides step-by-step instructions to configure Azure App Registrations for the front-end and back-end applications.
1517

docs/CustomizeSchemaData.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ The response returns a Schema `Id` — **save this** for Step 3.
166166
167167
### Option B: Register via script (batch)
168168

169-
> **Note:** The default sample schemas are registered **automatically** during `azd up` via the post-provisioning hook. You only need to run the script manually if you are adding custom schemas or if automatic registration was skipped.
169+
> **Note:** Default sample schemas are registered when you run the post-deployment script manually (see Deployment Guide Step 5.1). Run this script again whenever you add or update schemas.
170170
171171
For bulk registration, use the provided script with a JSON manifest. The script performs three steps automatically:
172172
1. **Registers** individual schema files via `/schemavault/`

docs/DeploymentGuide.md

Lines changed: 58 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -301,149 +301,100 @@ azd up
301301

302302
## Step 5: Post-Deployment Configuration
303303

304-
### 5.1 Schema Registration (Automatic)
304+
### 5.1 Run Schema Registration (Manual)
305305

306-
> Want to customize the schemas for your own documents? [Learn more about adding your own schemas here.](./CustomizeSchemaData.md)
306+
> Want to customize the schemas for your own documents? [Learn more about adding your own schemas here.](./CustomizeSchemaData.md)
307307

308-
Schema registration happens **automatically** as part of the `azd up` post-provisioning hook — no manual steps required. After infrastructure is deployed, the hook:
308+
`azd up` now provisions infrastructure and application containers only. Post-provision data setup is split into **separate manual steps** so you can run, retry, or skip them independently.
309309

310-
1. Waits for the API container app to be ready
311-
2. Registers the sample schema files (auto claim, damaged car image, police report, repair estimate)
312-
3. Creates an **"Auto Claim"** schema set
313-
4. Adds all registered schemas into the schema set
314-
5. Processes sample file bundles (`claim_date_of_loss/` and `claim_hail/`) — creates claim batches, uploads files with their mapped schemas, and submits them for processing
310+
Run schema registration first to:
315311

316-
After successful deployment, the terminal displays container app details and schema registration output:
312+
1. Wait for the API container app to be ready
313+
2. Register the sample schema files (auto claim, damaged car image, police report, repair estimate)
314+
3. Create the **"Auto Claim"** schema set
315+
4. Add all registered schemas into the schema set
317316

318-
```
319-
🧭 Web App Details:
320-
✅ Name: ca-<env>-web
321-
🌐 Endpoint: ca-<env>-web.<region>.azurecontainerapps.io
322-
🔗 Portal URL: https://portal.azure.com/#resource/...
323-
324-
🧭 API App Details:
325-
✅ Name: ca-<env>-api
326-
🌐 Endpoint: ca-<env>-api.<region>.azurecontainerapps.io
327-
🔗 Portal URL: https://portal.azure.com/#resource/...
328-
329-
🧭 Workflow App Details:
330-
✅ Name: ca-<env>-wkfl
331-
🔗 Portal URL: https://portal.azure.com/#resource/...
332-
333-
📦 Registering schemas and creating schema set...
334-
⏳ Waiting for API to be ready...
335-
✅ API is ready.
336-
============================================================
337-
Step 1: Register schemas
338-
============================================================
339-
✓ Successfully registered: Auto Insurance Claim Form's Schema Id - <id>
340-
✓ Successfully registered: Damaged Vehicle Image Assessment's Schema Id - <id>
341-
✓ Successfully registered: Police Report Document's Schema Id - <id>
342-
✓ Successfully registered: Repair Estimate Document's Schema Id - <id>
343-
344-
============================================================
345-
Step 2: Create schema set
346-
============================================================
347-
✓ Created schema set 'Auto Claim' with ID: <id>
348-
349-
============================================================
350-
Step 3: Add schemas to schema set
351-
============================================================
352-
✓ Added 'AutoInsuranceClaimForm' (<id>) to schema set
353-
✓ Added 'DamagedVehicleImageAssessment' (<id>) to schema set
354-
✓ Added 'PoliceReportDocument' (<id>) to schema set
355-
✓ Added 'RepairEstimateDocument' (<id>) to schema set
356-
357-
============================================================
358-
Schema registration process completed.
359-
Schema set ID: <id>
360-
Schemas added: 4
361-
============================================================
362-
363-
============================================================
364-
Step 4: Process sample file bundles
365-
============================================================
366-
367-
📂 Processing bundle: claim_date_of_loss
368-
✅ Claim batch created with ID: <id>
369-
✅ Uploaded 'claim_form.pdf' successfully.
370-
✅ Uploaded 'damage_photo.png' successfully.
371-
✅ Uploaded 'police_report.pdf' successfully.
372-
✅ Uploaded 'repair_estimate.pdf' successfully.
373-
✅ Claim batch '<id>' submitted for processing.
374-
375-
📂 Processing bundle: claim_hail
376-
✅ Claim batch created with ID: <id>
377-
✅ Uploaded 'claim_form.pdf' successfully.
378-
✅ Uploaded 'damage_photo.png' successfully.
379-
✅ Uploaded 'repair_estimate.pdf' successfully.
380-
✅ Claim batch '<id>' submitted for processing.
381-
382-
============================================================
383-
Sample file processing completed.
384-
============================================================
385-
```
317+
**Windows (PowerShell):**
386318

387-
### 5.2 Configure Authentication (Automatic)
319+
```powershell
320+
./infra/scripts/register_schemas.ps1
321+
```
388322

389-
Starting with this release, authentication is configured **automatically** as part of the `azd up` post-provisioning hook. The hook:
323+
**macOS/Linux:**
390324

391-
1. Creates two Entra ID app registrations (`<env>-web-app`, `<env>-api-app`) with the correct redirect URIs, exposed scopes, and required permissions
392-
2. Grants admin consent (best effort — see note below)
393-
3. Mints client secrets and stores them in Container Apps secrets
394-
4. Enables the Microsoft identity provider on both the Web and API container apps
395-
5. Restricts the API to only accept tokens from the Web app (`allowedApplications`)
396-
6. Sets the `APP_WEB_CLIENT_ID`, `APP_WEB_SCOPE`, `APP_API_SCOPE`, and `APP_AUTH_ENABLED` environment variables on the Web container
325+
```bash
326+
sed -i 's/\r$//' ./infra/scripts/register_schemas.sh
327+
bash ./infra/scripts/register_schemas.sh
328+
```
397329

398-
You will see an **`🔐 Configuring Entra ID authentication`** section in the `azd up` output, ending with a summary of both client IDs and scopes.
330+
The script is idempotent and safe to re-run.
399331

400-
> **Note:** EasyAuth can take up to 10 minutes to fully propagate. If the Web app returns 500/401 immediately after deployment, wait a few minutes and retry.
332+
### 5.2 Run Sample Data Upload (Manual)
401333

402-
#### When automatic configuration is not possible
334+
After schema registration completes, upload the sample bundles as a separate explicit step. This step:
403335

404-
Automatic configuration requires permission to:
405-
- Create Entra ID app registrations (**Application Administrator** or equivalent)
406-
- Grant admin consent for delegated permissions (**Cloud Application Administrator** or **Global Administrator**)
336+
1. Resolves the existing **Auto Claim** schema set and registered schema IDs
337+
2. Creates sample claim batches for `claim_date_of_loss` and `claim_hail`
338+
3. Uploads each file with its mapped schema
339+
4. Submits each claim batch for processing
407340

408-
If your identity cannot grant admin consent, the script prints a clear manual action message like:
341+
**Windows (PowerShell):**
409342

343+
```powershell
344+
./infra/scripts/upload_sample_data.ps1
410345
```
411-
⚠️ Admin consent failed. Sign-in may fail until a tenant admin runs:
412-
az ad app permission admin-consent --id <web-client-id>
413-
Or visit: https://login.microsoftonline.com/<tenant>/adminconsent?client_id=<web-client-id>
346+
347+
**macOS/Linux:**
348+
349+
```bash
350+
sed -i 's/\r$//' ./infra/scripts/upload_sample_data.sh
351+
bash ./infra/scripts/upload_sample_data.sh
414352
```
415353

416-
In that case, share the command/URL with your tenant administrator.
354+
### 5.3 Configure Authentication (Manual Script)
355+
356+
Run authentication setup as an explicit step after post-deployment data setup:
357+
358+
**Windows (PowerShell):**
417359

418-
#### Skipping automatic auth configuration
360+
```powershell
361+
./infra/scripts/setup_auth.ps1
362+
```
419363

420-
If your tenant blocks programmatic app registration, or you prefer to configure authentication manually, disable the automation before running `azd up`:
364+
**macOS/Linux:**
421365

422366
```bash
423-
azd env set AZURE_SKIP_AUTH_SETUP true
367+
sed -i 's/\r$//' ./infra/scripts/setup_auth.sh
368+
bash ./infra/scripts/setup_auth.sh
424369
```
425370

426-
Then follow the manual instructions: [App Authentication Configuration (manual)](./ConfigureAppAuthentication.md).
371+
The auth script is idempotent and performs preflight validation before making changes.
372+
373+
#### Required Permissions for auth setup
374+
375+
- Create/update app registrations: **Application Administrator**, **Cloud Application Administrator**, or **Global Administrator**
376+
- Grant admin consent: **Cloud Application Administrator** or **Global Administrator**
377+
- Update Container Apps auth/secret settings: **Contributor** on the deployment resource group
427378

428-
#### Re-running
379+
If permissions are insufficient, the script exits early (or warns before consent) with clear remediation guidance.
429380

430-
The automation is idempotent: re-running `azd up` reuses the existing app registrations (IDs are persisted in `AZURE_AUTH_WEB_CLIENT_ID` / `AZURE_AUTH_API_CLIENT_ID` in the azd environment) and does not rotate client secrets.
381+
> **Note:** EasyAuth can take up to 10 minutes to fully propagate. If the Web app returns 500/401 immediately after setup, wait a few minutes and retry.
431382

432383
#### WAF (Well-Architected Framework) deployments
433384

434-
The automation is fully compatible with the WAF / production profile (`main.waf.parameters.json`, which enables `enablePrivateNetworking`, `enableRedundancy`, and `enableScalability`). The Web and API container apps keep external ingress in the default WAF profile, so the redirect URIs registered by the script (`https://<fqdn>/.auth/login/aad/callback`) remain the correct public entry points. All script operations use the Azure management plane (Graph + ARM) and are unaffected by the private networking applied to backend resources such as Storage, Cosmos DB, and ACR.
385+
Authentication script execution is fully compatible with the WAF / production profile (`main.waf.parameters.json`, which enables `enablePrivateNetworking`, `enableRedundancy`, and `enableScalability`). The Web and API container apps keep external ingress in the default WAF profile, so registered redirect URIs (`https://<fqdn>/.auth/login/aad/callback`) remain valid public entry points.
435386

436-
> If you further customize the WAF deployment to make the Web or API container app ingress **internal-only**, automatic configuration still runs, but end-user access to the sign-in page will require reaching the private endpoint (e.g., via the deployed jumpbox or a VPN).
387+
> If you customize WAF to make Web or API ingress internal-only, run the auth script from an environment that can reach those private endpoints (for example, the deployed jumpbox or a VPN-connected host).
437388

438-
### 5.3 Verify Deployment
389+
### 5.4 Verify Deployment
439390

440391
1. Access your application using the **Web App Endpoint** from the deployment output.
441392
2. Confirm the application loads successfully.
442393
3. Verify you can sign in with your authenticated account.
443394

444-
### 5.4 Test the Application
395+
### 5.5 Test the Application
445396

446-
> **Note:** The post-deployment hook automatically uploads and processes two sample claim bundles (`claim_date_of_loss` and `claim_hail`). You can verify the results in the web app immediately after deployment.
397+
> **Note:** If you ran [Step 5.2](#52-run-sample-data-upload-manual), two sample claim bundles (`claim_date_of_loss` and `claim_hail`) should already be processed in the web app.
447398

448399
**Quick Test Steps:**
449400
1. **Check Processed Results**: Open the web app — you should see the two sample claim batches already processed with extracted data.

0 commit comments

Comments
 (0)