Skip to content

Commit 25381f5

Browse files
committed
Merge branch 'macae-v3-dev-v2-vip' of https://github.com/microsoft/Multi-Agent-Custom-Automation-Engine-Solution-Accelerator into macae-v3-dev-marktayl
2 parents 872998d + 429ae90 commit 25381f5

File tree

74 files changed

+8853
-49693
lines changed

Some content is hidden

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

74 files changed

+8853
-49693
lines changed

.github/workflows/deploy-waf.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,15 @@ jobs:
109109
--resource-group ${{ env.RESOURCE_GROUP_NAME }} \
110110
--template-file infra/main.bicep \
111111
--parameters \
112-
environmentName=${{ env.SOLUTION_PREFIX }} \
113-
useWafAlignedArchitecture=true \
114-
aiDeploymentsLocation='${{ env.AZURE_LOCATION }}' \
112+
solutionName=${{ env.SOLUTION_PREFIX }} \
113+
location="${{ env.AZURE_LOCATION }}" \
114+
azureAiServiceLocation='${{ env.AZURE_LOCATION }}' \
115115
gptModelCapacity=5 \
116-
virtualMachineConfiguration='{"adminUsername": "adminuser", "adminPassword": "P@ssw0rd1234"}' \
117-
logAnalyticsWorkspaceConfiguration='{"existingWorkspaceResourceId": ""}'
118-
116+
enableTelemetry=true \
117+
enableMonitoring=true \
118+
enablePrivateNetworking=true \
119+
enableScalability=true \
120+
119121
120122
- name: Send Notification on Failure
121123
if: failure()

.github/workflows/deploy.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,19 +129,16 @@ jobs:
129129
--resource-group ${{ env.RESOURCE_GROUP_NAME }} \
130130
--template-file infra/main.bicep \
131131
--parameters \
132-
environmentName=${{ env.SOLUTION_PREFIX }} \
133-
solutionLocation="${{ env.AZURE_LOCATION }}" \
134-
modelDeploymentType="GlobalStandard" \
132+
solutionName=${{ env.SOLUTION_PREFIX }} \
133+
location="${{ env.AZURE_LOCATION }}" \
134+
gptModelDeploymentType="GlobalStandard" \
135135
gptModelName="gpt-4o" \
136136
gptModelVersion="2024-08-06" \
137-
imageTag="${IMAGE_TAG}" \
138-
useWafAlignedArchitecture=false \
139-
aiDeploymentsLocation='${{ env.AZURE_LOCATION }}' \
137+
backendContainerImageTag="${IMAGE_TAG}" \
138+
frontendContainerImageTag="${IMAGE_TAG}" \
139+
azureAiServiceLocation='${{ env.AZURE_LOCATION }}' \
140140
gptModelCapacity=150 \
141-
logAnalyticsWorkspaceConfiguration='{"dataRetentionInDays": 30, "existingWorkspaceResourceId": ""}' \
142-
applicationInsightsConfiguration='{"retentionInDays": 30}' \
143-
virtualNetworkConfiguration='{"enabled": false}' \
144-
webServerFarmConfiguration='{"skuCapacity": 1, "skuName": "B2"}' \
141+
createdBy="Pipeline" \
145142
--output json
146143
147144
- name: Extract Web App and API App URLs

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
- name: Run tests with coverage
5252
if: env.skip_tests == 'false'
5353
run: |
54-
pytest --cov=. --cov-report=term-missing --cov-report=xml
54+
pytest --cov=. --cov-report=term-missing --cov-report=xml --ignore=tests/e2e-test/tests
5555
5656
- name: Skip coverage report if no tests
5757
if: env.skip_tests == 'true'

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,4 +460,7 @@ __pycache__/
460460
.azure
461461
.github/copilot-instructions.md
462462
# Ignore sample code folder
463-
data/sample_code/
463+
data/sample_code/
464+
# Bicep local files
465+
*.local*.bicepparam
466+
*.local*.parameters.json

azure.yaml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,38 @@ name: multi-agent-custom-automation-engine-solution-accelerator
33
metadata:
44
55
requiredVersions:
6-
azd: ">=1.15.0 !=1.17.1"
6+
azd: ">=1.15.0 !=1.17.1"
7+
hooks:
8+
postdeploy:
9+
windows:
10+
run: |
11+
Write-Host "To upload Team Configurations to Cosmos. Run the following command in PowerShell:"
12+
Write-Host "infra\scripts\Upload-Team-Config.ps1" -ForegroundColor Cyan
13+
Write-Host ""
14+
Write-Host "To index Sample Data into Azure Search. Run the following command in PowerShell:"
15+
Write-Host "infra\scripts\Process-Sample-Data.ps1" -ForegroundColor Cyan
16+
Write-Host ""
17+
Write-Host "To upload team configurations and index sample data both in one command, you can use the following command in PowerShell:"
18+
Write-Host "infra\scripts\Team-Config-And-Data.ps1" -ForegroundColor Cyan
19+
Write-Host ""
20+
Write-Host "You can access the deployed Frontend application at the following URL:"
21+
Write-Host "https://$env:webSiteDefaultHostname" -ForegroundColor Cyan
22+
shell: pwsh
23+
interactive: true
24+
posix:
25+
run: |
26+
Blue='\033[0;34m'
27+
NC='\033[0m'
28+
echo "To upload Team Configurations to Cosmos. Run the following command in Bash:"
29+
echo "${Blue}bash infra/scripts/upload_team_config.sh"
30+
echo ""
31+
echo "${NC}To index Sample Data into Azure Search. Run the following command in Bash:"
32+
echo "${Blue}bash infra/scripts/process_sample_data.sh"
33+
echo ""
34+
echo "${NC}To upload team configurations and index sample data both in one command, you can use the following command in Bash:"
35+
echo "${Blue}bash infra/scripts/team_config_and_data.sh"
36+
echo ""
37+
echo "${NC}You can access the deployed Frontend application at the following URL:"
38+
echo "${Blue}https://$webSiteDefaultHostname"
39+
shell: sh
40+
interactive: true

azure_custom.yaml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,39 @@ services:
3838
shell: sh
3939
run: bash ../../infra/scripts/package_frontend.sh
4040
interactive: true
41-
continueOnError: false
41+
continueOnError: false
42+
43+
hooks:
44+
postdeploy:
45+
windows:
46+
run: |
47+
Write-Host "To upload Team Configurations to Cosmos. Run the following command in PowerShell:"
48+
Write-Host "infra\scripts\Upload-Team-Config.ps1" -ForegroundColor Cyan
49+
Write-Host ""
50+
Write-Host "To index Sample Data into Azure Search. Run the following command in PowerShell:"
51+
Write-Host "infra\scripts\Process-Sample-Data.ps1" -ForegroundColor Cyan
52+
Write-Host ""
53+
Write-Host "If you want to run both scripts as single command, you can use the following command in PowerShell:"
54+
Write-Host "infra\scripts\Team-Config-And-Data.ps1" -ForegroundColor Cyan
55+
Write-Host ""
56+
Write-Host "You can access the deployed Frontend application at the following URL:"
57+
Write-Host "https://$env:webSiteDefaultHostname" -ForegroundColor Cyan
58+
shell: pwsh
59+
interactive: true
60+
posix:
61+
run: |
62+
Blue='\033[0;34m'
63+
NC='\033[0m'
64+
echo "To upload Team Configurations to Cosmos. Run the following command in Bash:"
65+
echo "${Blue}bash infra/scripts/upload_team_config.sh"
66+
echo ""
67+
echo "${NC}To index Sample Data into Azure Search. Run the following command in Bash:"
68+
echo "${Blue}bash infra/scripts/process_sample_data.sh"
69+
echo ""
70+
echo "${NC}If you want to run both scripts as single command, you can use the following command in Bash:"
71+
echo "${Blue}bash infra/scripts/team_config_and_data.sh"
72+
echo ""
73+
echo "${NC}You can access the deployed Frontend application at the following URL:"
74+
echo "${Blue}https://$webSiteDefaultHostname"
75+
shell: sh
76+
interactive: true

docs/CustomizingAzdParameters.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ By default this template will use the environment name as the prefix to prevent
1919
| `AZURE_ENV_IMAGETAG` | string | `latest` | Docker image tag used for container deployments. |
2020
| `AZURE_ENV_ENABLE_TELEMETRY` | bool | `true` | Enables telemetry for monitoring and diagnostics. |
2121
| `AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID` | string | Guide to get your [Existing Workspace ID](/docs/re-use-log-analytics.md) | Set this if you want to reuse an existing Log Analytics Workspace instead of creating a new one. |
22+
| `AZURE_ENV_VM_ADMIN_USERNAME` | string | `take(newGuid(), 20)` | The administrator username for the virtual machine. |
23+
| `AZURE_ENV_VM_ADMIN_PASSWORD` | string | `newGuid()` | The administrator password for the virtual machine. |
2224
---
2325

2426
## How to Set a Parameter

docs/DeploymentGuide.md

Lines changed: 118 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,42 +26,68 @@ Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
2626

2727
This will allow the scripts to run for the current session without permanently changing your system's policy.
2828

29+
### **Azure Developer CLI (azd) Requirement**
30+
31+
Ensure that you are using the latest version of the [Azure Developer CLI](https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/overview).
32+
The `azd` version must be **1.18.0 or higher**.
33+
34+
Upgrade commands by OS:
35+
36+
* **Windows (using winget):**
37+
38+
```bash
39+
winget install microsoft.azd
40+
```
41+
42+
* **Linux (using apt):**
43+
44+
```bash
45+
curl -fsSL https://aka.ms/install-azd.sh | bash
46+
```
47+
48+
* **macOS (using Homebrew):**
49+
50+
```bash
51+
brew update && brew tap azure/azd && brew install azd
52+
```
53+
2954
## Deployment Options & Steps
3055

3156
### Sandbox or WAF Aligned Deployment Options
3257

3358
The [`infra`](../infra) folder of the Multi Agent Solution Accelerator contains the [`main.bicep`](../infra/main.bicep) Bicep script, which defines all Azure infrastructure components for this solution.
3459

35-
When running `azd up`, you’ll now be prompted to choose between a **WAF-aligned configuration** and a **sandbox configuration** using a simple selection:
60+
By default, the `azd up` command uses the [`main.parameters.json`](../infra/main.parameters.json) file to deploy the solution. This file is pre-configured for a **sandbox environment** — ideal for development and proof-of-concept scenarios, with minimal security and cost controls for rapid iteration.
3661

37-
- A **sandbox environment** — ideal for development and proof-of-concept scenarios, with minimal security and cost controls for rapid iteration.
62+
For **production deployments**, the repository also provides [`main.waf.parameters.json`](../infra/main.waf.parameters.json), which applies a [Well-Architected Framework (WAF) aligned](https://learn.microsoft.com/en-us/azure/well-architected/) configuration. This option enables additional Azure best practices for reliability, security, cost optimization, operational excellence, and performance efficiency, such as:
3863

39-
- A **production deployments environment**, which applies a [Well-Architected Framework (WAF) aligned](https://learn.microsoft.com/en-us/azure/well-architected/) configuration. This option enables additional Azure best practices for reliability, security, cost optimization, operational excellence, and performance efficiency, such as:
4064
- Enhanced network security (e.g., Network protection with private endpoints)
4165
- Stricter access controls and managed identities
4266
- Logging, monitoring, and diagnostics enabled by default
4367
- Resource tagging and cost management recommendations
4468

4569
**How to choose your deployment configuration:**
4670

47-
When prompted during `azd up`:
71+
* Use the default `main.parameters.json` file for a **sandbox/dev environment**
72+
* For a **WAF-aligned, production-ready deployment**, copy the contents of `main.waf.parameters.json` into `main.parameters.json` before running `azd up`
4873

49-
![useWAFAlignedArchitecture](images/macae_waf_prompt.png)
74+
---
5075

51-
- Select **`true`** to deploy a **WAF-aligned, production-ready environment**
52-
- Select **`false`** to deploy a **lightweight sandbox/dev environment**
76+
### VM Credentials Configuration
77+
78+
By default, the solution sets the VM administrator username and password from environment variables.
79+
If you do not configure these values, a randomly generated GUID will be used for both the username and password.
80+
81+
To set your own VM credentials before deployment, use:
82+
83+
```sh
84+
azd env set AZURE_ENV_VM_ADMIN_USERNAME <your-username>
85+
azd env set AZURE_ENV_VM_ADMIN_PASSWORD <your-password>
86+
```
5387

5488
> [!TIP]
5589
> Always review and adjust parameter values (such as region, capacity, security settings and log analytics workspace configuration) to match your organization’s requirements before deploying. For production, ensure you have sufficient quota and follow the principle of least privilege for all identities and role assignments.
5690
57-
> To reuse an existing Log Analytics workspace, update the existingWorkspaceResourceId field under the logAnalyticsWorkspaceConfiguration parameter in the .bicep file with the resource ID of your existing workspace.
58-
For example:
59-
```
60-
param logAnalyticsWorkspaceConfiguration = {
61-
dataRetentionInDays: 30
62-
existingWorkspaceResourceId: '/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.OperationalInsights/workspaces/<workspace-name>'
63-
}
64-
```
6591

6692
> [!IMPORTANT]
6793
> The WAF-aligned configuration is under active development. More Azure Well-Architected recommendations will be added in future updates.
@@ -213,11 +239,51 @@ Once you've opened the project in [Codespaces](#github-codespaces), [Dev Contain
213239
- This deployment will take _4-6 minutes_ to provision the resources in your account and set up the solution with sample data.
214240
- If you encounter an error or timeout during deployment, changing the location may help, as there could be availability constraints for the resources.
215241

216-
5. Once the deployment has completed successfully, open the [Azure Portal](https://portal.azure.com/), go to the deployed resource group, find the App Service, and get the app URL from `Default domain`.
242+
5. After deployment completes, you can upload Team Configurations using command printed in the terminal. The command will look like one of the following. Run the appropriate command for your shell from the project root:
243+
244+
- **For Bash (Linux/macOS/WSL):**
245+
```bash
246+
bash infra/scripts/upload_team_config.sh
247+
```
248+
249+
- **For PowerShell (Windows):**
250+
```powershell
251+
infra\scripts\Upload-Team-Config.ps1
252+
```
253+
254+
6. After deployment completes, you can index Sample Data into Search Service using command printed in the terminal. The command will look like one of the following. Run the appropriate command for your shell from the project root:
217255

218-
6. When Deployment is complete, follow steps in [Set Up Authentication in Azure App Service](../docs/azure_app_service_auth_setup.md) to add app authentication to your web app running on Azure App Service
256+
- **For Bash (Linux/macOS/WSL):**
257+
```bash
258+
bash infra/scripts/process_sample_data.sh
259+
```
219260

220-
7. If you are done trying out the application, you can delete the resources by running `azd down`.
261+
- **For PowerShell (Windows):**
262+
```powershell
263+
infra\scripts\Process-Sample-Data.ps1
264+
```
265+
266+
7. To upload team configurations and index sample data in one step. Run the appropriate command for your shell from the project root:
267+
268+
- **For Bash (Linux/macOS/WSL):**
269+
```bash
270+
bash infra/scripts/team_config_and_data.sh
271+
```
272+
273+
- **For PowerShell (Windows):**
274+
```powershell
275+
infra\scripts\Team-Config-And-Data.ps1
276+
```
277+
278+
8. Once the deployment has completed successfully, open the [Azure Portal](https://portal.azure.com/), go to the deployed resource group, find the App Service, and get the app URL from `Default domain`.
279+
280+
9. When Deployment is complete, follow steps in [Set Up Authentication in Azure App Service](../docs/azure_app_service_auth_setup.md) to add app authentication to your web app running on Azure App Service
281+
282+
10. If you are done trying out the application, you can delete the resources by running `azd down`.
283+
284+
285+
### 🛠️ Troubleshooting
286+
If you encounter any issues during the deployment process, please refer [troubleshooting](../docs/TroubleShootingSteps.md) document for detailed steps and solutions.
221287

222288
# Local setup
223289

@@ -324,27 +390,39 @@ The files for the dev container are located in `/.devcontainer/` folder.
324390
- Update the `.env` file with the required values from your Azure resource group in Azure Portal App Service environment variables.
325391
- Alternatively, if resources were
326392
provisioned using `azd provision` or `azd up`, a `.env` file is automatically generated in the `.azure/<env-name>/.env`
327-
file. To get your `<env-name>` run `azd env list` to see which env is default.
393+
file. You can copy the contents of this file into your backend `.env` file.
394+
395+
_**Note**: To get your `<env-name>` run `azd env list` to see which env is default._
328396
329397
6. **Fill in the `.env` file:**
330398
331399
- Use the output from the deployment or check the Azure Portal under "Deployments" in the resource group.
332400
- Make sure to set APP_ENV to "**dev**" in `.env` file.
401+
- For local development, make sure to include below env variables in the `.env`
402+
- `BACKEND_API_URL=http://localhost:8000`
403+
- `FRONTEND_SITE_NAME=http://127.0.0.1:3000` .
333404
334405
7. **(Optional) Set up a virtual environment:**
335406
336407
- If you are using `venv`, create and activate your virtual environment for both the frontend and backend folders.
337408
338-
8. **Install requirements - frontend:**
409+
8. **Install requirements - Backend:**
339410
340-
- In each of the frontend and backend folders -
341-
Open a terminal in the `src` folder and run:
411+
- To install the requirement for backend -
412+
Open a terminal in the `src/backend` folder and run:
342413
```bash
343-
pip install -r requirements.txt
414+
pip install uv
415+
uv sync
344416
```
345417
346418
9. **Build the frontend (important):**
347419
420+
- To install the requirement for frontend -
421+
Open a terminal in the `src/frontend` folder and run:
422+
```bash
423+
pip install -r requirements.txt
424+
```
425+
348426
- Before running the frontend server, you must build the frontend to generate the necessary `build/assets` directory.
349427
350428
From the `src/frontend` directory, run:
@@ -356,7 +434,7 @@ The files for the dev container are located in `/.devcontainer/` folder.
356434
357435
10. **Run the application:**
358436
359-
- From the src/backend directory:
437+
- From the `src/backend` directory activate the virtual environment created through step 8 and Run:
360438
361439
```bash
362440
python app_kernel.py
@@ -368,8 +446,22 @@ python app_kernel.py
368446
python frontend_server.py
369447
```
370448
371-
10. Open a browser and navigate to `http://localhost:3000`
372-
11. To see swagger API documentation, you can navigate to `http://localhost:8000/docs`
449+
or Run
450+
451+
```bash
452+
npm run dev
453+
```
454+
455+
11. Open a browser and navigate to `http://localhost:3000`
456+
12. To see swagger API documentation, you can navigate to `http://localhost:8000/docs`
457+
458+
## Deploy Your local changes
459+
To Deploy your local changes rename the below files.
460+
1. Rename `azure.yaml` to `azure_custom2.yaml` and `azure_custom.yaml` to `azure.yaml`.
461+
2. Go to `infra` directory
462+
- Remove `main.bicep` to `main_custom2.bicep` and `main_custom.bicep` to `main.bicep`.
463+
Continue with the [deploying steps](#deploying-with-azd).
464+
373465
374466
## Debugging the solution locally
375467

0 commit comments

Comments
 (0)