Skip to content

Commit 779875a

Browse files
Merge branch 'dev' into smoke-testing-test-cases
2 parents b5c3d0f + 848a0aa commit 779875a

34 files changed

+2256
-131
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
# Each line is a file pattern followed by one or more owners.
33

44
# These owners will be the default owners for everything in the repo.
5-
* @toherman-msft @Avijit-Microsoft @Roopan-Microsoft @Prajwal-Microsoft @Vinay-Microsoft @malrose07 @aniaroramsft
5+
* @toherman-msft @Avijit-Microsoft @Roopan-Microsoft @Prajwal-Microsoft @Vinay-Microsoft @malrose07 @aniaroramsft @nchandhi
66

.github/workflows/deploy-v2.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ env:
8989
CLEANUP_RESOURCES: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.cleanup_resources || true) || true }}
9090
RUN_E2E_TESTS: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.run_e2e_tests || true) || true }}
9191
BUILD_DOCKER_IMAGE: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.build_docker_image || false) || false }}
92+
AZURE_DEV_COLLECT_TELEMETRY: ${{ vars.AZURE_DEV_COLLECT_TELEMETRY }}
9293

9394
jobs:
9495
docker-build:
@@ -456,14 +457,13 @@ jobs:
456457
457458
echo "Setting default subscription..."
458459
azd config set defaults.subscription ${{ secrets.AZURE_SUBSCRIPTION_ID }}
459-
460+
460461
# Set additional parameters
461462
azd env set AZURE_SUBSCRIPTION_ID="${{ secrets.AZURE_SUBSCRIPTION_ID }}"
462463
azd env set AZURE_ENV_OPENAI_LOCATION="$AZURE_ENV_OPENAI_LOCATION"
463464
azd env set AZURE_LOCATION="$AZURE_LOCATION"
464465
azd env set AZURE_RESOURCE_GROUP="$RESOURCE_GROUP_NAME"
465466
azd env set AZURE_ENV_IMAGETAG="${{ steps.determine_image_tag.outputs.IMAGE_TAG }}"
466-
azd env set AZURE_DEV_COLLECT_TELEMETRY="no"
467467
468468
# Set ACR name only when building Docker image
469469
if [[ "${{ env.BUILD_DOCKER_IMAGE }}" == "true" ]]; then

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ Follow the quick deploy steps on the deployment guide to deploy this solution to
7272
[Click here to launch the deployment guide](./docs/DeploymentGuide.md)
7373
<br/><br/>
7474

75-
| [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/microsoft/document-generation-solution-accelerator) | [![Open in Dev Containers](https://img.shields.io/static/v1?style=for-the-badge&label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/document-generation-solution-accelerator) |
76-
|---|---|
75+
| [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/microsoft/document-generation-solution-accelerator) | [![Open in Dev Containers](https://img.shields.io/static/v1?style=for-the-badge&label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/document-generation-solution-accelerator) | [![Open in Visual Studio Code Web](https://img.shields.io/static/v1?style=for-the-badge&label=Visual%20Studio%20Code%20(Web)&message=Open&color=blue&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/azure/?vscode-azure-exp=foundry&agentPayload=eyJiYXNlVXJsIjogImh0dHBzOi8vcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbS9taWNyb3NvZnQvZG9jdW1lbnQtZ2VuZXJhdGlvbi1zb2x1dGlvbi1hY2NlbGVyYXRvci9yZWZzL2hlYWRzL21haW4vaW5mcmEvdnNjb2RlX3dlYiIsICJpbmRleFVybCI6ICIvaW5kZXguanNvbiIsICJ2YXJpYWJsZXMiOiB7ImFnZW50SWQiOiAiIiwgImNvbm5lY3Rpb25TdHJpbmciOiAiIiwgInRocmVhZElkIjogIiIsICJ1c2VyTWVzc2FnZSI6ICIiLCAicGxheWdyb3VuZE5hbWUiOiAiIiwgImxvY2F0aW9uIjogIiIsICJzdWJzY3JpcHRpb25JZCI6ICIiLCAicmVzb3VyY2VJZCI6ICIiLCAicHJvamVjdFJlc291cmNlSWQiOiAiIiwgImVuZHBvaW50IjogIiJ9LCAiY29kZVJvdXRlIjogWyJhaS1wcm9qZWN0cy1zZGsiLCAicHl0aG9uIiwgImRlZmF1bHQtYXp1cmUtYXV0aCIsICJlbmRwb2ludCJdfQ==) |
76+
|---|---|---|
7777

7878
<br/>
7979

azure_custom.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
environment:
2+
name: document-generation
3+
location: eastus
4+
5+
name: document-generation
6+
metadata:
7+
8+
9+
requiredVersions:
10+
azd: '>= 1.18.0'
11+
12+
parameters:
13+
solutionPrefix:
14+
type: string
15+
default: bs-azdtest
16+
otherLocation:
17+
type: string
18+
default: eastus2
19+
baseUrl:
20+
type: string
21+
default: 'https://github.com/microsoft/document-generation-solution-accelerator'
22+
23+
services:
24+
webapp:
25+
project: ./src
26+
language: py
27+
host: appservice
28+
dist: ./dist
29+
hooks:
30+
prepackage:
31+
windows:
32+
shell: pwsh
33+
run: ../infra/scripts/package_webapp.ps1
34+
interactive: true
35+
continueOnError: false
36+
posix:
37+
shell: sh
38+
run: bash ../infra/scripts/package_webapp.sh
39+
interactive: true
40+
continueOnError: false
41+
42+
deployment:
43+
mode: Incremental
44+
template: ./infra/main.bicep # Path to the main.bicep file inside the 'deployment' folder
45+
parameters:
46+
solutionPrefix: ${parameters.solutionPrefix}
47+
otherLocation: ${parameters.otherLocation}
48+
baseUrl: ${parameters.baseUrl}

docs/DeploymentGuide.md

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ azd env set AZURE_ENV_VM_ADMIN_PASSWORD <your-password>
6464
6565
## Deployment Options & Steps
6666

67-
Pick from the options below to see step-by-step instructions for GitHub Codespaces, VS Code Dev Containers, and Local Environments.
67+
Pick from the options below to see step-by-step instructions for GitHub Codespaces, VS Code Dev Containers, Visual Studio Code (WEB) and Local Environments.
6868

69-
| [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/microsoft/document-generation-solution-accelerator) | [![Open in Dev Containers](https://img.shields.io/static/v1?style=for-the-badge&label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/document-generation-solution-accelerator) |
70-
|---|---|
69+
| [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/microsoft/document-generation-solution-accelerator) | [![Open in Dev Containers](https://img.shields.io/static/v1?style=for-the-badge&label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/microsoft/document-generation-solution-accelerator) | [![Open in Visual Studio Code Web](https://img.shields.io/static/v1?style=for-the-badge&label=Visual%20Studio%20Code%20(Web)&message=Open&color=blue&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/azure/?vscode-azure-exp=foundry&agentPayload=eyJiYXNlVXJsIjogImh0dHBzOi8vcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbS9taWNyb3NvZnQvZG9jdW1lbnQtZ2VuZXJhdGlvbi1zb2x1dGlvbi1hY2NlbGVyYXRvci9yZWZzL2hlYWRzL21haW4vaW5mcmEvdnNjb2RlX3dlYiIsICJpbmRleFVybCI6ICIvaW5kZXguanNvbiIsICJ2YXJpYWJsZXMiOiB7ImFnZW50SWQiOiAiIiwgImNvbm5lY3Rpb25TdHJpbmciOiAiIiwgInRocmVhZElkIjogIiIsICJ1c2VyTWVzc2FnZSI6ICIiLCAicGxheWdyb3VuZE5hbWUiOiAiIiwgImxvY2F0aW9uIjogIiIsICJzdWJzY3JpcHRpb25JZCI6ICIiLCAicmVzb3VyY2VJZCI6ICIiLCAicHJvamVjdFJlc291cmNlSWQiOiAiIiwgImVuZHBvaW50IjogIiJ9LCAiY29kZVJvdXRlIjogWyJhaS1wcm9qZWN0cy1zZGsiLCAicHl0aG9uIiwgImRlZmF1bHQtYXp1cmUtYXV0aCIsICJlbmRwb2ludCJdfQ==) |
70+
|---|---|--|
7171

7272
<details>
7373
<summary><b>Deploy in GitHub Codespaces</b></summary>
@@ -103,6 +103,38 @@ You can run this solution in VS Code Dev Containers, which will open the project
103103

104104
</details>
105105

106+
<details>
107+
<summary><b>Deploy in Visual Studio Code (WEB)</b></summary>
108+
109+
### Visual Studio Code (WEB)
110+
111+
You can run this solution in VS Code Web. The button will open a web-based VS Code instance in your browser:
112+
113+
1. Open the solution accelerator (this may take several minutes):
114+
115+
[![Open in Visual Studio Code Web](https://img.shields.io/static/v1?style=for-the-badge&label=Visual%20Studio%20Code%20(Web)&message=Open&color=blue&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/azure/?vscode-azure-exp=foundry&agentPayload=eyJiYXNlVXJsIjogImh0dHBzOi8vcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbS9taWNyb3NvZnQvZG9jdW1lbnQtZ2VuZXJhdGlvbi1zb2x1dGlvbi1hY2NlbGVyYXRvci9yZWZzL2hlYWRzL21haW4vaW5mcmEvdnNjb2RlX3dlYiIsICJpbmRleFVybCI6ICIvaW5kZXguanNvbiIsICJ2YXJpYWJsZXMiOiB7ImFnZW50SWQiOiAiIiwgImNvbm5lY3Rpb25TdHJpbmciOiAiIiwgInRocmVhZElkIjogIiIsICJ1c2VyTWVzc2FnZSI6ICIiLCAicGxheWdyb3VuZE5hbWUiOiAiIiwgImxvY2F0aW9uIjogIiIsICJzdWJzY3JpcHRpb25JZCI6ICIiLCAicmVzb3VyY2VJZCI6ICIiLCAicHJvamVjdFJlc291cmNlSWQiOiAiIiwgImVuZHBvaW50IjogIiJ9LCAiY29kZVJvdXRlIjogWyJhaS1wcm9qZWN0cy1zZGsiLCAicHl0aG9uIiwgImRlZmF1bHQtYXp1cmUtYXV0aCIsICJlbmRwb2ludCJdfQ==)
116+
117+
2. When prompted, sign in using your Microsoft account linked to your Azure subscription.
118+
119+
Select the appropriate subscription to continue.
120+
121+
3. Once the solution opens, the **AI Foundry terminal** will automatically start running the following command to install the required dependencies:
122+
123+
```shell
124+
sh install.sh
125+
```
126+
During this process, you’ll be prompted with the message:
127+
```
128+
What would you like to do with these files?
129+
- Overwrite with versions from template
130+
- Keep my existing files unchanged
131+
```
132+
Choose “**Overwrite with versions from template**” and provide a unique environment name when prompted.
133+
134+
4. Continue with the [deploying steps](#deploying-with-azd).
135+
136+
</details>
137+
106138
<details>
107139
<summary><b>Deploy in your local Environment</b></summary>
108140

@@ -172,7 +204,7 @@ To adjust quota settings, follow these [steps](./AzureGPTQuotaSettings.md).
172204

173205
### Deploying with AZD
174206

175-
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:
207+
Once you've opened the project in [Codespaces](#github-codespaces), [Dev Containers](#vs-code-dev-containers), [Visual Studio Code (WEB)](#visual-studio-code-web) or [locally](#local-environment), you can deploy it to Azure by following these steps:
176208
177209
1. Login to Azure:
178210
@@ -209,10 +241,11 @@ Once you've opened the project in [Codespaces](#github-codespaces), [Dev Contain
209241

210242
6. 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`.
211243

212-
7. You can now delete the resources by running `azd down`, if you are done trying out the application.
244+
7. You can now delete the resources by running `azd down`, if you are done trying out the application.
245+
> **Note:** If you deployed with `enableRedundancy=true` and Log Analytics workspace replication is enabled, you must first disable replication before running `azd down` else resource group delete will fail. Follow the steps in [Handling Log Analytics Workspace Deletion with Replication Enabled](./LogAnalyticsReplicationDisable.md), wait until replication returns `false`, then run `azd down`.
213246

214247
### 🛠️ Troubleshooting
215-
If you encounter any issues during the deployment process, please refer [troubleshooting](../docs/TroubleShootingSteps.md) document for detailed steps and solutions
248+
If you encounter any issues during the deployment process, please refer [troubleshooting](../docs/TroubleShootingSteps.md) document for detailed steps and solutions
216249

217250
## Post Deployment Steps
218251

@@ -226,6 +259,17 @@ Once you've opened the project in [Codespaces](#github-codespaces), [Dev Contain
226259

227260
- Follow steps in [Delete Resource Group](./DeleteResourceGroup.md) if your deployment fails and/or you need to clean up the resources.
228261

262+
## Deploy Your Local Changes
263+
264+
To deploy your local changes, rename the below files:
265+
266+
1. Rename `azure.yaml` to `azure_custom2.yaml` and `azure_custom.yaml` to `azure.yaml`.
267+
268+
2. **Go to `infra` directory:**
269+
- Rename `main.bicep` to `main_custom2.bicep` and `main_custom.bicep` to `main.bicep`.
270+
271+
3. Continue with the [deploying steps](#deploying-with-azd).
272+
229273
## Environment configuration for local development & debugging
230274
> Set APP_ENV in your .env file to control Azure authentication. Set the environment variable to dev to use Azure CLI credentials, or to prod to use Managed Identity for production. **Ensure you're logged in via az login when using dev in local**.
231275
To configure your environment, follow these steps:

docs/LocalDebuggingSetup.md

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# Local Debugging Setup
2+
3+
Follow the steps below to set up and run the **Document-Generation-Solution-Accelerator** locally.
4+
5+
6+
7+
## Prerequisites
8+
9+
Install these tools before you start:
10+
- [Visual Studio Code](https://code.visualstudio.com/) with the following extensions:
11+
- [Azure Tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-node-azure-pack)
12+
- [Bicep](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-bicep)
13+
- [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python)
14+
- [Python 3.11](https://www.python.org/downloads/). **Important:** Check "Add Python to PATH" during installation.
15+
- [PowerShell 7.0+](https://github.com/PowerShell/PowerShell#get-powershell).
16+
- [Node.js (LTS)](https://nodejs.org/en).
17+
- [Git](https://git-scm.com/downloads).
18+
- [Azure Developer CLI (azd) v1.18.0+](https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/install-azd).
19+
- [Microsoft ODBC Driver 17](https://learn.microsoft.com/en-us/sql/connect/odbc/download-odbc-driver-for-sql-server?view=sql-server-ver16) for SQL Server.
20+
21+
22+
## Setup Steps
23+
24+
### Clone the Repository
25+
26+
Choose a location on your local machine where you want to store the project files. We recommend creating a dedicated folder for your development projects.
27+
28+
#### Using Command Line/Terminal
29+
30+
1. **Open your terminal or command prompt. Navigate to your desired directory and Clone the repository:**
31+
```bash
32+
git clone https://github.com/microsoft/document-generation-solution-accelerator.git
33+
```
34+
35+
2. **Navigate to the project directory:**
36+
```bash
37+
cd document-generation-solution-accelerator
38+
```
39+
40+
3. **Open the project in Visual Studio Code:**
41+
```bash
42+
code .
43+
```
44+
45+
## Local Setup/Debugging
46+
47+
Follow these steps to set up and run the application locally:
48+
49+
### 1. Open the App Folder
50+
Navigate to the `src` directory of the repository using Visual Studio Code.
51+
52+
### 2. Configure Environment Variables
53+
- Copy the `.env.sample` file to a new file named `.env`.
54+
- Update the `.env` file with the required values from your Azure resource group in Azure Portal App Service environment variables.
55+
- You can get all env value in your deployed resource group under App Service:
56+
![Enviorment Variables](images/Enviorment_variables.png)
57+
- Alternatively, if resources were
58+
provisioned using `azd provision` or `azd up`, a `.env` file is automatically generated in the `.azure/<env-name>/.env`
59+
file. To get your `<env-name>` run `azd env list` to see which env is default.
60+
61+
### 3. Start the Application
62+
- Run `start.cmd` (Windows) or `start.sh` (Linux/Mac) to:
63+
- Install backend dependencies.
64+
- Install frontend dependencies.
65+
- Build the frontend.
66+
- Start the backend server.
67+
- Alternatively, you can run the backend in debug mode using the VS Code debug configuration defined in `.vscode/launch.json`.
68+
69+
## Running with Automated Script
70+
71+
For convenience, you can use the provided startup scripts that handle environment setup and start both services:
72+
73+
**Windows:**
74+
```cmd
75+
cd src
76+
.\start.cmd
77+
```
78+
79+
**macOS/Linux:**
80+
```bash
81+
cd src
82+
chmod +x start.sh
83+
./start.sh
84+
```
85+
86+
## Running Backend and Frontend Separately
87+
88+
#### Step 1: Create Virtual Environment (Recommended)
89+
90+
Open your terminal and navigate to the root folder of the project, then create the virtual environment:
91+
92+
```bash
93+
# Navigate to the project root folder
94+
cd document-generation-solution-accelerator
95+
96+
# Create virtual environment in the root folder
97+
python -m venv .venv
98+
99+
# Activate virtual environment (Windows)
100+
.venv/Scripts/activate
101+
102+
# Activate virtual environment (macOS/Linux)
103+
source .venv/bin/activate
104+
```
105+
106+
> **Note**: After activation, you should see `(.venv)` in your terminal prompt indicating the virtual environment is active.
107+
108+
#### Step 2: Install Dependencies and Run
109+
110+
To develop and run the backend API locally:
111+
112+
```bash
113+
# Navigate to the API folder (while virtual environment is activated)
114+
cd src/
115+
116+
# Upgrade pip
117+
python -m pip install --upgrade pip
118+
119+
# Install Python dependencies
120+
pip install -r requirements.txt
121+
122+
# Install Fronend Packages
123+
cd src/frontend
124+
npm install
125+
npm run build
126+
127+
# Run the backend API
128+
cd src/
129+
130+
start http://127.0.0.1:50505
131+
call python -m uvicorn app:app --port 50505 --reload
132+
```
133+
134+
> **Note**: Make sure your virtual environment is activated before running these commands. You should see `(.venv)` in your terminal prompt when the virtual environment is active.
135+
136+
The App will run on `http://127.0.0.1:50505/#/` by default.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# 🛠 Handling Log Analytics Workspace Deletion with Replication Enabled
2+
3+
If redundancy (replication) is enabled for your Log Analytics workspace, you must disable it before deleting the workspace or resource group. Otherwise, deletion will fail.
4+
5+
## ✅ Steps to Disable Replication Before Deletion
6+
Run the following Azure CLI command. Note: This operation may take about 5 minutes to complete.
7+
8+
```bash
9+
az resource update --ids "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{logAnalyticsName}" --set properties.replication.enabled=false
10+
```
11+
12+
Replace:
13+
- `{subscriptionId}` → Your Azure subscription ID
14+
- `{resourceGroupName}` → The name of your resource group
15+
- `{logAnalyticsName}` → The name of your Log Analytics workspace
16+
17+
Optional: Verify replication disabled (should output `false`):
18+
```bash
19+
az resource show --ids "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{logAnalyticsName}" --query properties.replication.enabled -o tsv
20+
```
21+
22+
## ✅ After Disabling Replication
23+
You can safely delete:
24+
- The Log Analytics workspace (manual)
25+
- The resource group (manual), or
26+
- All provisioned resources via `azd down`
27+
28+
Return to: [Deployment Guide](./DeploymentGuide.md)
91.7 KB
Loading

infra/main.bicep

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,11 @@ module keyvault 'br/public:avm/res/key-vault/vault:0.12.1' = {
11051105
{name: 'AZURE-OPENAI-PREVIEW-API-VERSION', value: azureOpenaiAPIVersion}
11061106
{name: 'AZURE-OPEN-AI-DEPLOYMENT-MODEL', value: gptModelName}
11071107
{name: 'TENANT-ID', value: subscription().tenantId}
1108+
{
1109+
name: 'AZURE-AI-AGENT-ENDPOINT'
1110+
value: aiFoundryAiProjectEndpoint
1111+
}
1112+
11081113
]
11091114
}
11101115
dependsOn:[
@@ -1204,6 +1209,9 @@ module webSite 'modules/web-sites.bicep' = {
12041209
UWSGI_THREADS: '2'
12051210
APP_ENV: appEnvironment
12061211
AZURE_CLIENT_ID: userAssignedIdentity.outputs.clientId
1212+
AZURE_BASIC_LOGGING_LEVEL: 'INFO'
1213+
AZURE_PACKAGE_LOGGING_LEVEL: 'WARNING'
1214+
AZURE_LOGGING_PACKAGES: ''
12071215
}
12081216
// WAF aligned configuration for Monitoring
12091217
applicationInsightResourceId: enableMonitoring ? applicationInsights!.outputs.resourceId : null

0 commit comments

Comments
 (0)