Skip to content

Commit 2c9e8a1

Browse files
Merge branch 'main' into psl-re-use-log-analytic-update
2 parents d0c1a4b + a8a5665 commit 2c9e8a1

33 files changed

+42399
-6692
lines changed

.github/workflows/deploy.yml

Lines changed: 74 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,43 @@ jobs:
3636
run: |
3737
az login --service-principal -u ${{ secrets.AZURE_CLIENT_ID }} -p ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }}
3838
39+
- name: Run Quota Check
40+
id: quota-check
41+
run: |
42+
export AZURE_CLIENT_ID=${{ secrets.AZURE_CLIENT_ID }}
43+
export AZURE_TENANT_ID=${{ secrets.AZURE_TENANT_ID }}
44+
export AZURE_CLIENT_SECRET=${{ secrets.AZURE_CLIENT_SECRET }}
45+
export AZURE_SUBSCRIPTION_ID="${{ secrets.AZURE_SUBSCRIPTION_ID }}"
46+
export GPT_MIN_CAPACITY="${{ env.GPT_MIN_CAPACITY }}"
47+
export AZURE_REGIONS="${{ vars.AZURE_REGIONS }}"
48+
chmod +x scripts/checkquota.sh
49+
if ! scripts/checkquota.sh; then
50+
# If quota check fails due to insufficient quota, set the flag
51+
if grep -q "No region with sufficient quota found" scripts/checkquota.sh; then
52+
echo "QUOTA_FAILED=true" >> $GITHUB_ENV
53+
fi
54+
exit 1 # Fail the pipeline if any other failure occurs
55+
fi
56+
57+
- name: Send Notification on Quota Failure
58+
if: env.QUOTA_FAILED == 'true'
59+
run: |
60+
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
61+
EMAIL_BODY=$(cat <<EOF
62+
{
63+
"body": "<p>Dear Team,</p><p>The quota check has failed, and the pipeline cannot proceed.</p><p><strong>Build URL:</strong> <a href=\"${RUN_URL}\">${RUN_URL}</a></p><p>Please take necessary action.</p><p>Best regards,<br>Your Automation Team</p>"
64+
}
65+
EOF
66+
)
67+
68+
curl -X POST "${{ secrets.LOGIC_APP_URL }}" \
69+
-H "Content-Type: application/json" \
70+
-d "$EMAIL_BODY" || echo "Failed to send notification"
71+
72+
- name: Fail Pipeline if Quota Check Fails
73+
if: env.QUOTA_FAILED == 'true'
74+
run: exit 1
75+
3976
- name: Install Bicep CLI
4077
run: az bicep install
4178

@@ -94,11 +131,11 @@ jobs:
94131
--resource-group ${{ env.RESOURCE_GROUP_NAME }} \
95132
--template-file infra/main.bicep \
96133
--parameters \
97-
Prefix="${{ env.SOLUTION_PREFIX }}" \
98-
AzureAiServiceLocation="eastus" \
134+
solutionName="${{ env.SOLUTION_PREFIX }}" \
135+
aiDeploymentsLocation="eastus" \
136+
useWafAlignedArchitecture=false \
99137
capacity=${{ env.GPT_MIN_CAPACITY }} \
100-
imageVersion="${IMAGE_TAG}"\
101-
--debug
138+
imageVersion="${IMAGE_TAG}"
102139
103140
- name: Get Deployment Output and extract Values
104141
id: get_output
@@ -111,24 +148,6 @@ jobs:
111148
echo "WEBAPP_URL=$WEBAPP_URL" >> $GITHUB_OUTPUT
112149
echo "Deployment output: $BICEP_OUTPUT"
113150
114-
- name: Send Notification on Failure
115-
if: failure()
116-
run: |
117-
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
118-
119-
# Construct the email body
120-
EMAIL_BODY=$(cat <<EOF
121-
{
122-
"body": "<p>Dear Team,</p><p>We would like to inform you that the Modernize-your-code-solution-accelerator Automation process has encountered an issue and has failed to complete successfully.</p><p><strong>Build URL:</strong> ${RUN_URL}<br> ${OUTPUT}</p><p>Please investigate the matter at your earliest convenience.</p><p>Best regards,<br>Your Automation Team</p>"
123-
}
124-
EOF
125-
)
126-
127-
# Send the notification
128-
curl -X POST "${{ secrets.LOGIC_APP_URL }}" \
129-
-H "Content-Type: application/json" \
130-
-d "$EMAIL_BODY" || echo "Failed to send notification"
131-
132151
- name: Logout from Azure
133152
if: always()
134153
run: |
@@ -171,7 +190,6 @@ jobs:
171190
172191
if [ -z "$log_analytics_workspace_name" ]; then
173192
echo "No Log Analytics workspace found in resource group ${{ env.RESOURCE_GROUP_NAME }}."
174-
exit 1
175193
else
176194
echo "LOG_ANALYTICS_WORKSPACE_NAME=${log_analytics_workspace_name}" >> $GITHUB_ENV
177195
echo "Log Analytics workspace name: ${log_analytics_workspace_name}"
@@ -224,22 +242,6 @@ jobs:
224242
echo "KEYVAULTS=$keyvault_array" >> $GITHUB_ENV
225243
fi
226244
227-
- name: Purge log analytics workspace
228-
if: always()
229-
id: log_analytics_workspace
230-
run: |
231-
232-
set -e
233-
# Purge Log Analytics Workspace
234-
echo "Purging the Log Analytics Workspace..."
235-
if ! az monitor log-analytics workspace delete --force --resource-group ${{ env.RESOURCE_GROUP_NAME }} --workspace-name ${{ env.LOG_ANALYTICS_WORKSPACE_NAME }} --yes --verbose; then
236-
echo "Failed to purge Log Analytics workspace: ${{ env.LOG_ANALYTICS_WORKSPACE_NAME }}"
237-
else
238-
echo "Purged the Log Analytics workspace: ${{ env.LOG_ANALYTICS_WORKSPACE_NAME }}"
239-
fi
240-
241-
echo "Log analytics workspace resource purging completed successfully"
242-
243245
- name: Delete Bicep Deployment
244246
if: always()
245247
run: |
@@ -257,6 +259,23 @@ jobs:
257259
echo "Resource group does not exists."
258260
fi
259261
262+
- name: Purge log analytics workspace
263+
if: always()
264+
id: log_analytics_workspace
265+
run: |
266+
267+
set -e
268+
# Purge Log Analytics Workspace
269+
echo "Purging the Log Analytics Workspace..."
270+
if ! az monitor log-analytics workspace delete --force --resource-group ${{ env.RESOURCE_GROUP_NAME }} --workspace-name ${{ env.LOG_ANALYTICS_WORKSPACE_NAME }} --yes --verbose; then
271+
echo "Failed to purge Log Analytics workspace: ${{ env.LOG_ANALYTICS_WORKSPACE_NAME }}"
272+
else
273+
echo "Purged the Log Analytics workspace: ${{ env.LOG_ANALYTICS_WORKSPACE_NAME }}"
274+
fi
275+
276+
echo "Log analytics workspace resource purging completed successfully"
277+
278+
260279
- name: Wait for resource deletion to complete
261280
if: always()
262281
run: |
@@ -363,6 +382,22 @@ jobs:
363382
done
364383
echo "Resource purging completed successfully"
365384
385+
- name: Send Notification on Failure
386+
if: failure() || needs.deploy.result == 'failure'
387+
run: |
388+
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
389+
390+
EMAIL_BODY=$(cat <<EOF
391+
{
392+
"body": "<p>Dear Team,</p><p>We would like to inform you that the DocGen Deployment Automation process has encountered an issue and has failed to complete successfully.</p><p><strong>Build URL:</strong> <a href=\"${RUN_URL}\">${RUN_URL}</a><br></p><p>Please investigate the matter at your earliest convenience.</p><p>Best regards,<br>Your Automation Team</p>"
393+
}
394+
EOF
395+
)
396+
397+
curl -X POST "${{ secrets.LOGIC_APP_URL }}" \
398+
-H "Content-Type: application/json" \
399+
-d "$EMAIL_BODY" || echo "Failed to send notification"
400+
366401
- name: Logout from Azure
367402
if: always()
368403
run: |

README.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The Modernize your code solution accelerator allows users to specify a group of
88
<br/>
99

1010
<div align="center">
11-
11+
1212
[**SOLUTION OVERVIEW**](#solution-overview) \| [**QUICK DEPLOY**](#quick-deploy) \| [**BUSINESS SCENARIO**](#business-scenario) \| [**SUPPORTING DOCUMENTATION**](#supporting-documentation)
1313

1414
</div>
@@ -24,7 +24,10 @@ The solution leverages Azure AI Foundry, Azure OpenAI Service, Azure Container A
2424
|![image](./docs/images/read_me/solArchitecture.png)|
2525
|---|
2626

27+
This architecture will be deployed with the 'sandbox' setting of our deployment process. Optionally you can deploy [Well-Architected Framework (WAF) aligned](https://learn.microsoft.com/en-us/azure/well-architected/) architecture, described in [WAF-Aligned Solution Architecture](./docs/ArchitectureWAF.md), with the WAF-Aligned deployment option described in [Deployment Guide](./docs/DeploymentGuide.md).
28+
2729
### Agentic architecture
30+
2831
|![image](./docs/images/read_me/agentArchitecture.png)|
2932
|---|
3033

@@ -51,16 +54,16 @@ If you'd like to customize the solution accelerator, here are some common areas
5154
<summary>Click to learn more about the key features this solution enables</summary>
5255

5356
- **Code language modernization** <br/>
54-
Modernizing outdated code ensures compatibility with current technologies, reduces reliance on legacy expertise, and keeps businesses competitive.
57+
Modernizing outdated code ensures compatibility with current technologies, reduces reliance on legacy expertise, and keeps businesses competitive.
5558

5659
- **Summary and review of new code** <br/>
57-
Generating summaries and translating code files keeps humans in the loop, enhances their understanding, and facilitates timely interventions, ensuring the files are ready to export.
60+
Generating summaries and translating code files keeps humans in the loop, enhances their understanding, and facilitates timely interventions, ensuring the files are ready to export.
5861

5962
- **Business logic analysis** <br/>
60-
Leveraging AI to decipher business logic from legacy code helps minimizes the risk of human error.
63+
Leveraging AI to decipher business logic from legacy code helps minimizes the risk of human error.
6164

6265
- **Efficient code transformation** <br/>
63-
Streamlining the process of analyzing, converting, and iterative error testing reduces time and effort required to modernize the systems.
66+
Streamlining the process of analyzing, converting, and iterative error testing reduces time and effort required to modernize the systems.
6467

6568
</details>
6669

@@ -77,7 +80,7 @@ Follow the quick deploy steps on the deployment guide to deploy this solution to
7780

7881
| [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/microsoft/Modernize-your-Code-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/Modernize-your-Code-Solution-Accelerator) |
7982
|---|---|
80-
83+
8184
<br/>
8285

8386
> ⚠️ **Important: Check Azure OpenAI Quota Availability**
@@ -141,19 +144,19 @@ The sample data used in this repository is synthetic and generated using Azure O
141144
<summary>Click to learn more about what value this solution provides</summary>
142145

143146
- **Accelerated Migration** <br/>
144-
Automate the translation of SQL queries, significantly reducing migration time and effort.
147+
Automate the translation of SQL queries, significantly reducing migration time and effort.
145148

146149
- **Error Reduction** <br/>
147-
Multi-agent validation ensures accurate translations and maintains data integrity.
150+
Multi-agent validation ensures accurate translations and maintains data integrity.
148151

149152
- **Knowledge Preservation** <br/>
150-
Captures and preserves business logic during the modernization process.
153+
Captures and preserves business logic during the modernization process.
151154

152155
- **Cost Efficiency** <br/>
153-
Reduces reliance on specialized legacy system expertise and manual translation efforts.
156+
Reduces reliance on specialized legacy system expertise and manual translation efforts.
154157

155158
- **Standardization** <br/>
156-
Ensures consistent query translation across the organization.
159+
Ensures consistent query translation across the organization.
157160

158161
</details>
159162

azure.yaml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
environment:
2-
name: modernize-your-code-solution-accelerator
3-
location: eastus
41
name: modernize-your-code-solution-accelerator
52
metadata:
63
@@ -21,19 +18,3 @@ deployment:
2118
AzureAiServiceLocation: ${{ parameters.AzureAiServiceLocation }}
2219
Prefix: ${{ parameters.Prefix }}
2320
baseUrl: ${{ parameters.baseUrl }}
24-
hooks:
25-
preprovision:
26-
posix:
27-
shell: sh
28-
run: >
29-
chmod u+r+x ./scripts/validate_model_deployment_quota.sh; chmod u+r+x ./scripts/validate_model_quota.sh; ./scripts/validate_model_deployment_quota.sh --SubscriptionId "$AZURE_SUBSCRIPTION_ID" --Location "${AZURE_AISERVICE_LOCATION:-japaneast}" --ModelsParameter "aiModelDeployments"
30-
interactive: false
31-
continueOnError: false
32-
33-
windows:
34-
shell: pwsh
35-
run: >
36-
$location = if ($env:AZURE_AISERVICE_LOCATION) { $env:AZURE_AISERVICE_LOCATION } else { "japaneast" };
37-
./scripts/validate_model_deployment_quota.ps1 -SubscriptionId $env:AZURE_SUBSCRIPTION_ID -Location $location -ModelsParameter "aiModelDeployments"
38-
interactive: false
39-
continueOnError: false

docs/ArchitectureWAF.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Azure WAF-Aligned Architecture
2+
3+
This architecture implements [Azure Well-Architected Framework (WAF)](https://learn.microsoft.com/en-us/azure/well-architected/) principles for enterprise-grade deployments, deployed with the WAF-Aligned deployment option:
4+
5+
![WAF-Aligned Architecture Diagram](../docs/images/read_me/solArchitectureWAF.png)
6+
7+
## WAF Pillars Implementation
8+
9+
### Security
10+
- **Zero Trust Network:** Private VNet with private endpoints for all PaaS services
11+
- **Identity & Access:** Managed identities with RBAC and least-privilege access
12+
- **Secure Admin Access:** Azure Bastion + Jumpbox for internal administration
13+
- **Secrets Management:** Azure Key Vault integration
14+
15+
### Operational Excellence
16+
- **Observability:** Centralized logging via Log Analytics Workspace
17+
- **Application Monitoring:** Application Insights for telemetry and diagnostics
18+
- **Infrastructure as Code:** Bicep templates with parameterized configurations
19+
20+
### Performance Efficiency
21+
- **Auto-scaling:** Container Apps with configurable scaling policies
22+
- **Regional Proximity:** Resources deployed in optimal Azure regions
23+
24+
### Cost Optimization
25+
- **Right-sizing:** Parameterized SKUs and capacity settings
26+
- **Resource Sharing:** Shared networking and monitoring infrastructure
27+
28+
### Reliability
29+
- **High Availability:** Multi-zone deployment options
30+
- **Data Redundancy:** Configurable geo-replication for critical data stores
31+
- **Private Connectivity:** Eliminates internet dependencies
32+
33+
## Core Architecture Components
34+
35+
| Component | Purpose | WAF Alignment |
36+
|-----------|---------|---------------|
37+
| **Virtual Network** | Network isolation boundary | Security, Reliability |
38+
| **Private Endpoints** | Secure PaaS connectivity (AI Services, Storage, Cosmos DB, Key Vault) | Security |
39+
| **Private DNS Zones** | Internal name resolution | Security, Reliability |
40+
| **Azure Bastion + Jumpbox** | Secure administrative access | Security |
41+
| **Container Apps** | Application hosting with VNet integration | Performance, Reliability |
42+
| **Log Analytics + App Insights** | Centralized monitoring and diagnostics | Operational Excellence |
43+
44+
## Deployment Configuration
45+
- **Configurable Parameters:** If user selects to deploy as WAF Aligned, Parameters like Monitoring, Scaling, VPN will get enabled.
46+
- **Network-first Design:** All components deployed within private network boundaries
47+
- **Enterprise-ready:** Production-grade security and monitoring enabled
48+
49+
## Application Information Flow
50+
51+
The application information flow remains the same for both 'sandbox' and 'waf-aligned' configuration.
52+
53+
The solution is composed of several services:
54+
55+
- The web app front end and the backend app logic are containerized and run from Azure Container service instances.
56+
- When a request for conversion is created in the web app admin console, the user specifies what files should be converted and the target SQL dialect for conversion.
57+
- These files are then uploaded to blob storage and initial data about the request is stored in Cosmos DB.
58+
- The conversion takes place using appropriate LLM models using multiple agents, with each agent having a dedicated purpose in the conversion process. As files are converted, they are placed into blob storage, with metadata collected into Cosmos detailing the conversion process and the current state of the batch.
59+
- Cosmos also stores the logs from the individual agents so the results can be fully reviewed before any of the converted files are put into production.

docs/CmsaArchitectureSource.pptx

352 KB
Binary file not shown.

docs/CustomizingAzdParameters.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ By default this template will use the environment name as the prefix to prevent
1717
| `AZURE_ENV_MODEL_CAPACITY` | integer | `200` | Set the Model Capacity (choose a number based on available GPT model capacity in your subscription). |
1818
| `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. |
1919
| `AZURE_ENV_IMAGETAG` | string | `latest` | Set the Image tag Like (allowed values: latest, dev, hotfix) |
20-
20+
| `AZURE_ENV_JUMPBOX_SIZE` | string | `Standard_DS2_v2` | Specifies the size of the Jumpbox Virtual Machine. Set a custom value if `enablePrivateNetworking` is `true`. |
2121
---
2222

2323
## How to Set a Parameter

docs/DeploymentGuide.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,14 @@ To change the azd parameters from the default values, follow the steps [here](..
181181
182182
1. Login to Azure:
183183
184-
```shell
185-
azd auth login
186-
```
184+
```shell
185+
azd auth login
186+
```
187187
188-
#### Note: To authenticate with Azure Developer CLI (`azd`) to a specific tenant, use the previous command with your **Tenant ID**:
188+
#### Note: To authenticate with Azure Developer CLI (`azd`) to a specific tenant, use the previous command with your **Tenant ID**:
189189
190-
```sh
191-
azd auth login --tenant-id <tenant-id>
190+
```sh
191+
azd auth login --tenant-id <tenant-id>
192192
```
193193
194194
2. Provide an `azd` environment name (like "cmsaapp")
@@ -202,7 +202,7 @@ To change the azd parameters from the default values, follow the steps [here](..
202202
```shell
203203
azd up
204204
```
205-
205+
206206
4. Select a subscription from your Azure account, and select a location which has quota for all the resources.
207207
* This deployment will take *6-9 minutes* to provision the resources in your account and set up the solution with sample data.
208208
* If you get an error or timeout with deployment, changing the location can help, as there may be availability constraints for the resources.
235 KB
Loading

0 commit comments

Comments
 (0)