Skip to content

Commit f9bc0ec

Browse files
Merge remote-tracking branch 'origin/dev' into dependabotchanges
2 parents e00a24a + ce582ad commit f9bc0ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+4282
-2910
lines changed

.devcontainer/setupEnv.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ yarn install
2323
cd ../../
2424

2525
echo "Setting up executable permission for shell scripts"
26-
sed -i 's/\r$//' ./infra/scripts/post_deployment.sh
27-
sudo chmod +x ./infra/scripts/docker-build.sh
28-
sudo chmod +x ./infra/scripts/post_deployment.sh
29-
sudo chmod +x ./src/ContentProcessorAPI/samples/upload_files.sh
30-
sudo chmod +x ./src/ContentProcessorAPI/samples/schemas/register_schema.sh
26+
sed -i 's/\r$//' infra/scripts/post_deployment.sh
27+
sudo chmod +x infra/scripts/docker-build.sh
28+
sudo chmod +x infra/scripts/post_deployment.sh
29+
sudo chmod +x src/ContentProcessorAPI/samples/upload_files.sh
30+
sudo chmod +x src/ContentProcessorAPI/samples/schemas/register_schema.sh
3131

3232
echo "Setup complete! 🎉"

.github/workflows/deploy.yml

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ jobs:
1616
propertydamageclaimform_schema_id: ${{ steps.register.outputs.propertylossdamageclaimform_schema_id }}
1717
RESOURCE_GROUP_NAME: ${{ steps.generate_rg_name.outputs.RESOURCE_GROUP_NAME }}
1818
CONTAINER_WEB_APPURL: ${{ steps.get_output.outputs.CONTAINER_WEB_APPURL }}
19-
SOLUTION_NAME: ${{ steps.get_output.outputs.SOLUTION_NAME }}
2019
DEPLOYMENT_SUCCESS: ${{ steps.deployment_status.outputs.SUCCESS }}
2120
AI_SERVICES_NAME: ${{ steps.get_ai_services_name.outputs.AI_SERVICES_NAME }}
2221
KEYVAULTS: ${{ steps.list_keyvaults.outputs.KEYVAULTS }}
@@ -137,25 +136,24 @@ jobs:
137136
# Install azd (Azure Developer CLI)
138137
curl -fsSL https://aka.ms/install-azd.sh | bash
139138
139+
# Generate current timestamp in desired format: YYYY-MM-DDTHH:MM:SS.SSSSSSSZ
140+
current_date=$(date -u +"%Y-%m-%dT%H:%M:%S.%7NZ")
141+
140142
echo "Running az deployment group create..."
141143
if ! DEPLOY_OUTPUT=$(az deployment group create \
142144
--resource-group ${{ env.RESOURCE_GROUP_NAME }} \
143145
--template-file infra/main.json \
144146
--parameters \
145147
environmentName="${{ env.ENVIRONMENT_NAME }}" \
146-
secondaryLocation="EastUs2" \
148+
enablePrivateNetworking="false" \
149+
secondaryLocation="eastus2" \
147150
contentUnderstandingLocation="WestUS" \
148151
deploymentType="GlobalStandard" \
149152
gptModelName="gpt-4o" \
150153
gptModelVersion="2024-08-06" \
151154
gptDeploymentCapacity="30" \
152-
minReplicaContainerApp="1" \
153-
maxReplicaContainerApp="1" \
154-
minReplicaContainerApi="1" \
155-
maxReplicaContainerApi="1" \
156-
minReplicaContainerWeb="1" \
157-
maxReplicaContainerWeb="1" \
158155
aiDeploymentsLocation="${{ env.AZURE_LOCATION }}" \
156+
tags="{'CreatedBy':'Pipeline', 'SecurityControl':'Ignore','Purpose':'Deploying and Cleaning Up Resources for Validation','CreatedDate':'$current_date'}" \
159157
--query "properties.outputs" -o json); then
160158
echo "❌ Deployment failed. See logs above."
161159
exit 1
@@ -171,18 +169,13 @@ jobs:
171169
export CONTAINER_API_APPNAME=$(echo "$DEPLOY_OUTPUT" | jq -r '.containeR_API_APP_NAME.value')
172170
echo "CONTAINER_API_APPNAME=$CONTAINER_API_APPNAME" >> $GITHUB_ENV
173171
174-
export CONTAINER_WEB_APPURL=$(echo "$DEPLOY_OUTPUT" | jq -r '.containeR_WEB_APP_FQDN.value')
172+
export CONTAINER_WEB_APPURL="https://$(echo "$DEPLOY_OUTPUT" | jq -r '.containeR_WEB_APP_FQDN.value')"
175173
echo "CONTAINER_WEB_APPURL=$CONTAINER_WEB_APPURL" >> $GITHUB_ENV
176174
echo "CONTAINER_WEB_APPURL=$CONTAINER_WEB_APPURL" >> $GITHUB_OUTPUT
177175
178176
export CONTAINER_WEB_APPNAME=$(echo "$DEPLOY_OUTPUT" | jq -r '.containeR_WEB_APP_NAME.value')
179177
echo "CONTAINER_WEB_APPNAME=$CONTAINER_WEB_APPNAME" >> $GITHUB_ENV
180178
181-
export SOLUTION_NAME=$(echo "$DEPLOY_OUTPUT" | jq -r '.solutioN_NAME.value')
182-
echo "SOLUTION_NAME=$SOLUTION_NAME" >> $GITHUB_ENV
183-
echo "SOLUTION_NAME=$SOLUTION_NAME" >> $GITHUB_OUTPUT
184-
185-
186179
- name: Register schemas
187180
id: register
188181
run: |
@@ -290,7 +283,6 @@ jobs:
290283
with:
291284
CP_WEB_URL: ${{ needs.deploy.outputs.CONTAINER_WEB_APPURL }}
292285
CP_RG: ${{ needs.deploy.outputs.RESOURCE_GROUP_NAME }}
293-
CP_CONTAINERAPP_PREFIX: ${{ format('ca-{0}', needs.deploy.outputs.SOLUTION_NAME ) }}
294286
secrets: inherit
295287

296288
cleanup:

.github/workflows/test-automation.yml

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,10 @@ on:
99
CP_RG:
1010
required: true
1111
type: string
12-
CP_CONTAINERAPP_PREFIX:
13-
required: true
14-
type: string
1512

1613
env:
1714
url: ${{ inputs.CP_WEB_URL }}
1815
CP_RG: ${{ inputs.CP_RG }}
19-
CP_CONTAINERAPP_PREFIX: ${{ inputs.CP_CONTAINERAPP_PREFIX }}
2016
accelerator_name: "Content Processing"
2117

2218

@@ -38,16 +34,6 @@ jobs:
3834
az login --service-principal -u ${{ secrets.AZURE_MAINTENANCE_CLIENT_ID }} -p ${{ secrets.AZURE_MAINTENANCE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }}
3935
az account set --subscription ${{ secrets.AZURE_MAINTENANCE_SUBSCRIPTION_ID }}
4036
41-
- name: Start Container App
42-
id: start-container-app
43-
uses: azure/cli@v2
44-
with:
45-
azcliversion: 'latest'
46-
inlineScript: |
47-
az rest -m post -u "/subscriptions/${{ secrets.AZURE_MAINTENANCE_SUBSCRIPTION_ID }}/resourceGroups/${{ env.CP_RG }}/providers/Microsoft.App/containerApps/${{ env.CP_CONTAINERAPP_PREFIX }}-app/start?api-version=2025-01-01"
48-
az rest -m post -u "/subscriptions/${{ secrets.AZURE_MAINTENANCE_SUBSCRIPTION_ID }}/resourceGroups/${{ env.CP_RG }}/providers/Microsoft.App/containerApps/${{ env.CP_CONTAINERAPP_PREFIX }}-api/start?api-version=2025-01-01"
49-
az rest -m post -u "/subscriptions/${{ secrets.AZURE_MAINTENANCE_SUBSCRIPTION_ID }}/resourceGroups/${{ env.CP_RG }}/providers/Microsoft.App/containerApps/${{ env.CP_CONTAINERAPP_PREFIX }}-web/start?api-version=2025-01-01"
50-
5137
- name: Install dependencies
5238
run: |
5339
python -m pip install --upgrade pip
@@ -159,15 +145,4 @@ jobs:
159145
# Send the notification
160146
curl -X POST "${{ secrets.EMAILNOTIFICATION_LOGICAPP_URL_TA }}" \
161147
-H "Content-Type: application/json" \
162-
-d "$EMAIL_BODY" || echo "Failed to send notification"
163-
164-
- name: Stop Container App
165-
if: always()
166-
uses: azure/cli@v2
167-
with:
168-
azcliversion: 'latest'
169-
inlineScript: |
170-
az rest -m post -u "/subscriptions/${{ secrets.AZURE_MAINTENANCE_SUBSCRIPTION_ID }}/resourceGroups/${{ env.CP_RG }}/providers/Microsoft.App/containerApps/${{ env.CP_CONTAINERAPP_PREFIX }}-app/stop?api-version=2025-01-01"
171-
az rest -m post -u "/subscriptions/${{ secrets.AZURE_MAINTENANCE_SUBSCRIPTION_ID }}/resourceGroups/${{ env.CP_RG }}/providers/Microsoft.App/containerApps/${{ env.CP_CONTAINERAPP_PREFIX }}-api/stop?api-version=2025-01-01"
172-
az rest -m post -u "/subscriptions/${{ secrets.AZURE_MAINTENANCE_SUBSCRIPTION_ID }}/resourceGroups/${{ env.CP_RG }}/providers/Microsoft.App/containerApps/${{ env.CP_CONTAINERAPP_PREFIX }}-web/stop?api-version=2025-01-01"
173-
az logout
148+
-d "$EMAIL_BODY" || echo "Failed to send notification"

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ Quick deploy
7171
### How to install or deploy
7272
Follow the quick deploy steps on the deployment guide to deploy this solution to your own Azure subscription.
7373

74+
> **Note:** This solution accelerator requires **Azure Developer CLI (azd) version 1.18.0 or higher**. Please ensure you have the latest version installed before proceeding with deployment. [Download azd here](https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/install-azd).
75+
7476
[Click here to launch the deployment guide](./docs/DeploymentGuide.md)
7577
<br/><br/>
7678

azure.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
name: content-processing
55

66
requiredVersions:
7-
azd: ">=1.15.0 !=1.17.1"
7+
azd: '>= 1.18.0'
88

99
metadata:
1010
template: content-processing@1.0

docs/ACRBuildAndPushGuide.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Azure Container Registry (ACR) – Build & Push Guide
2+
3+
This guide provides step-by-step instructions to build and push Docker images for **WebApp** and **Backend** services into Azure Container Registry (ACR).
4+
5+
## 📋 Prerequisites
6+
Before starting, ensure you have:
7+
- An active [Azure Subscription](https://portal.azure.com/)
8+
- [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) installed and logged in
9+
- [Docker Desktop](https://docs.docker.com/get-docker/) installed and running
10+
- Access to your Azure Container Registry (ACR)
11+
- To create an Azure Container Registry (ACR), you can refer to the following guides:
12+
13+
- [Create Container Registry using Azure CLI](https://learn.microsoft.com/en-us/azure/container-registry/container-registry-get-started-azure-cli)
14+
15+
- [Create Container Registry using Azure Portal](https://learn.microsoft.com/en-us/azure/container-registry/container-registry-get-started-portal?tabs=azure-cli)
16+
17+
- [Create Container Registry using PowerShell](https://learn.microsoft.com/en-us/azure/container-registry/container-registry-get-started-powershell)
18+
19+
- [Create Container Registry using ARM Template](https://learn.microsoft.com/en-us/azure/container-registry/container-registry-get-started-geo-replication-template)
20+
21+
- [Create Container Registry using Bicep](https://learn.microsoft.com/en-us/azure/container-registry/container-registry-get-started-bicep?tabs=CLI)
22+
23+
---
24+
25+
Login to ACR :
26+
``` bash
27+
az acr login --name $ACR_NAME
28+
```
29+
30+
## 🚀 Build and Push Images
31+
32+
**Backend :**
33+
34+
```bash
35+
az acr login --name <containerregname>
36+
docker build --no-cache -f docker/Backend.Dockerfile -t <acrloginserver>/<repo>:<tagname> .
37+
docker push <acrloginserver>/<repo>:<tagname>
38+
```
39+
40+
If you want to update image tag and image manually you can follow below steps:
41+
- Go to your **Container App** in the [Azure Portal](https://portal.azure.com/#home).
42+
- In the left menu, select **Containers**.
43+
- Under your container, update:
44+
45+
- Image source → Azure Container Registry / Docker Hub.
46+
47+
- Image name → myapp/backend.
48+
49+
- Tag → change to the new one you pushed (e.g., v2).
50+
51+
- Click **Save** → this will create a new revision automatically with the updated image.
52+
53+
![alt text](./images/ContainerApp.png)
54+
55+
**WebApp :**
56+
57+
```bash
58+
az acr login --name <containerregname>
59+
docker build --no-cache -f docker/Frontend.Dockerfile -t <acrloginserver>/<repo>:<tagname> .
60+
docker push <acrloginserver>/<repo>:<tagname>
61+
```
62+
63+
If you want to update image tag and image manually you can follow below steps:
64+
- Go to your App Service in the [Azure Portal](https://portal.azure.com/#home).
65+
- In the left menu, select Deployment → Deployment Center
66+
- Under Container settings, you can configure:
67+
68+
- Image Source → (e.g., Azure Container Registry / Docker Hub / Other).
69+
70+
- Image Name → e.g., myapp/backend.
71+
72+
- Tag → e.g., v1.2.3.
73+
74+
![alt text](./images/AppServiceContainer.png)
75+
76+
77+
## ✅ Verification
78+
79+
Run the following command to verify that images were pushed successfully:
80+
```bash
81+
az acr repository list --name $ACR_NAME --output table
82+
```
83+
84+
You should see repositories in the output.
85+
86+
## 📝 Notes
87+
88+
- Always use meaningful tags (v1.0.0, staging, prod) instead of just latest.
89+
90+
- If you are pushing from a CI/CD pipeline, make sure the pipeline agent has access to Docker and ACR.
91+
92+
- For private images, ensure your services (e.g., Azure Container Apps, AKS, App Service) are configured with appropriate ACR pull permissions.
93+
94+

docs/AVMPostDeploymentGuide.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# AVM Post Deployment Guide
2+
3+
> **📋 Note**: This guide is specifically for post-deployment steps after using the AVM template. For complete deployment from scratch, see the main [Deployment Guide](./DeploymentGuide.md).
4+
5+
---
6+
7+
This document provides guidance on post-deployment steps after deploying the Content processing solution accelerator from the [AVM (Azure Verified Modules) repository](https://github.com/Azure/bicep-registry-modules/tree/main/avm/ptn/sa/content-processing).
8+
9+
## Overview
10+
11+
After successfully deploying the Content Processing Solution Accelerator using the AVM template, you'll need to complete some configuration steps to make the solution fully operational.
12+
13+
## Prerequisites
14+
15+
Before starting the post-deployment process, ensure you have the following:
16+
17+
### Required Software
18+
19+
1. **[PowerShell](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-7.4)** <small>(v7.0+ recommended)</small> - Available for Windows, macOS, and Linux
20+
21+
2. **[Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli)** <small>(v2.50+)</small> - Command-line tool for managing Azure resources
22+
23+
3. **[Git](https://git-scm.com/downloads/)** - Version control system for cloning the repository
24+
25+
4. **Deployed Infrastructure** - A successful Content processing solution accelerator deployment from the [AVM repository](https://github.com/Azure/bicep-registry-modules/tree/main/avm/ptn/sa/content-processing)
26+
27+
#### Important Note for PowerShell Users
28+
29+
If you encounter issues running PowerShell scripts due to execution policy restrictions, you can temporarily adjust the `ExecutionPolicy` by running the following command in an elevated PowerShell session:
30+
31+
```powershell
32+
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
33+
```
34+
35+
This will allow the scripts to run for the current session without permanently changing your system's policy.
36+
37+
## Post-Deployment Steps
38+
39+
### Step 1: Clone the Repository
40+
41+
First, clone this repository to access the post-deployment scripts:
42+
43+
```powershell
44+
git clone https://github.com/microsoft/content-processing-solution-accelerator.git
45+
cd content-processing-solution-accelerator
46+
```
47+
48+
### Step 2: Complete Post-Deployment Configuration
49+
50+
Follow the **[Post Deployment Steps](./DeploymentGuide.md#post-deployment-steps)** section in the main Deployment Guide, which includes:
51+
52+
1. **[Optional: Publishing Local Build Container to Azure Container Registry](./DeploymentGuide.md#post-deployment-steps)**
53+
2. **[Register Schema Files](./DeploymentGuide.md#post-deployment-steps)**
54+
3. **[Import Sample Data](./DeploymentGuide.md#post-deployment-steps)**
55+
4. **[Add Authentication Provider](./DeploymentGuide.md#post-deployment-steps)**
56+
57+
## Next Steps
58+
59+
Once configuration is complete, see the **[Next Steps](./DeploymentGuide.md#next-steps)** section in the main Deployment Guide to start using the solution.

docs/CustomizingAzdParameters.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ By default this template will use the environment name as the prefix to prevent
1818
| `AZURE_ENV_MODEL_CAPACITY` | integer | `30` | Sets the model capacity (choose based on your subscription's available GPT capacity). |
1919
| `AZURE_ENV_IMAGETAG` | boolean | `latest` | Set the Image tag Like (allowed values: latest, dev, hotfix) |
2020
| `AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID` | string | Guide to get your [Existing Workspace ID](/docs/re-use-log-analytics.md) | Reuses an existing Log Analytics Workspace instead of provisioning a new one. |
21-
21+
| `AZURE_EXISTING_AI_PROJECT_RESOURCE_ID` | string | `<Existing AI Project resource Id>` | Reuses an existing AIFoundry and AIFoundryProject instead of creating a new one. |
2222

2323
## How to Set a Parameter
2424

docs/DeploymentGuide.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ If you're not using one of the above options for opening the project, then you'l
8787

8888
1. Make sure the following tools are installed:
8989
- [PowerShell](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-7.5) <small>(v7.0+)</small> - available for Windows, macOS, and Linux.
90-
- [Azure Developer CLI (azd)](https://aka.ms/install-azd) <small>(v1.15.0+)</small> - version
90+
- [Azure Developer CLI (azd)](https://aka.ms/install-azd) <small>(v1.18.0+)</small> - version
9191
- [Python 3.9+](https://www.python.org/downloads/)
9292
- [Docker Desktop](https://www.docker.com/products/docker-desktop/)
9393
- [Git](https://git-scm.com/downloads)
@@ -124,6 +124,7 @@ When you start the deployment, most parameters will have **default values**, but
124124
| **Use Local Build** | Boolean flag to determine if local container builds should be used. | false |
125125
| **Image Tag** | Image version for deployment (allowed values: `latest`, `dev`, `hotfix`). | latest |
126126
| **Existing Log Analytics Workspace** | To reuse an existing Log Analytics Workspace ID instead of creating a new one. | *(none)* |
127+
| **Existing Azure AI Foundry Project** | To reuse an existing Azure AI Foundry Project ID instead of creating a new one. | *(none)* |
127128

128129

129130
</details>
@@ -148,6 +149,14 @@ To adjust quota settings, follow these [steps](./AzureGPTQuotaSettings.md).
148149

149150
</details>
150151

152+
<details>
153+
154+
<summary><b>Reusing an Existing Azure AI Foundry Project</b></summary>
155+
156+
Guide to get your [Existing Project ID](/docs/re-use-foundry-project.md)
157+
158+
</details>
159+
151160
### Deploying with AZD
152161

153162
Once you've opened the project in [Codespaces](#github-codespaces), [Dev Containers](#vs-code-dev-containers), or [locally](#local-environment), you can deploy it to Azure by following these steps:
@@ -175,6 +184,7 @@ Once you've opened the project in [Codespaces](#github-codespaces), [Dev Contain
175184
```shell
176185
azd up
177186
```
187+
> **Note:** This solution accelerator requires **Azure Developer CLI (azd) version 1.18.0 or higher**. Please ensure you have the latest version installed before proceeding with deployment. [Download azd here](https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/install-azd).
178188
179189
3. Provide an `azd` environment name (e.g., "cpsapp").
180190
4. Select a subscription from your Azure account and choose a location that has quota for all the resources.
@@ -192,6 +202,9 @@ Once you've opened the project in [Codespaces](#github-codespaces), [Dev Contain
192202
193203
7. If you are done trying out the application, you can delete the resources by running `azd down`.
194204
205+
### 🛠️ Troubleshooting
206+
If you encounter any issues during the deployment process, please refer [troubleshooting](../docs/TroubleShootingSteps.md) document for detailed steps and solutions
207+
195208
## Post Deployment Steps
196209
1. Optional: Publishing Local Build Container to Azure Container Registry
197210
@@ -273,6 +286,21 @@ Once you've opened the project in [Codespaces](#github-codespaces), [Dev Contain
273286
274287
- Follow steps in [Delete Resource Group](./DeleteResourceGroup.md) if your deployment fails and/or you need to clean up the resources.
275288
289+
## Environment configuration for local development & debugging
290+
**Creatign env file**
291+
292+
> Navigate to the `src` folder of the project.
293+
294+
1. Locate the `.env` file inside the `src` directory.
295+
2. To fill in the required values, follow these steps
296+
- Go to the Azure Portal.
297+
- Navigate to your **Resource Group**.
298+
- Open the **Web Container** resource.
299+
- In the left-hand menu, select **Containers**.
300+
- Go to the **Environment Variables** tab.
301+
- Copy the necessary environment variable values and paste them into your local `.env` file.
302+
303+
276304
## Next Steps
277305
278306
Now that you've completed your deployment, you can start using the solution. Try out these things to start getting familiar with the capabilities:

0 commit comments

Comments
 (0)