Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
5cc5ee4
added opentelemetry logs
Priyanka-Microsoft May 12, 2025
7b5e59e
added exceptions logs also
Priyanka-Microsoft May 12, 2025
71f33de
updated requirement file
Priyanka-Microsoft May 13, 2025
56d6d3d
fixed keyerror
Priyanka-Microsoft May 13, 2025
33ad1e0
updated main.json
Priyanka-Microsoft May 13, 2025
ec813e1
feat: update devcontainer configuration to include Azure CLI and post…
Abdul-Microsoft May 16, 2025
98b0056
fix: update parameter names and documentation based on bugbash feedback
Abdul-Microsoft May 16, 2025
a7e1e10
fix: update allowed values for model name and deployment type in docu…
Abdul-Microsoft May 16, 2025
8c48d0d
resolved conflict
Priyanka-Microsoft May 26, 2025
68474d9
pylint issue
Priyanka-Microsoft May 26, 2025
987f2f6
pylint issue
Priyanka-Microsoft May 26, 2025
235a3ff
pylint issues resolved
Priyanka-Microsoft May 26, 2025
cacbd46
pylint issues resolved
Priyanka-Microsoft May 26, 2025
7560d67
pylint issue resolved
Priyanka-Microsoft May 26, 2025
afd29ff
pyline issue resolved
Priyanka-Microsoft May 26, 2025
cdc8bd3
pyline issue resolved
Priyanka-Microsoft May 26, 2025
1506052
pyline issue resolved
Priyanka-Microsoft May 26, 2025
a1a067b
pyline issue resolved
Priyanka-Microsoft May 26, 2025
fc11bbc
pyline issue resolved
Priyanka-Microsoft May 26, 2025
5ed4651
pyline issue resolved
Priyanka-Microsoft May 26, 2025
e1cfc2d
pyline issue resolved
Priyanka-Microsoft May 26, 2025
b3b172d
Merge remote-tracking branch 'origin/dev' into psl-bugbash-feedback
Abdul-Microsoft May 26, 2025
e96f339
Merge pull request #102 from microsoft/psl-bugbash-feedback
Roopan-Microsoft May 26, 2025
092fd4a
Merge pull request #98 from microsoft/feature/add-opentelemetry-logs
Roopan-Microsoft May 26, 2025
dc4f784
Added Test Automation scripts and pipeline
Harsh-Microsoft Jun 2, 2025
cc15915
fixed pylint issues
Harsh-Microsoft Jun 2, 2025
40f6976
folder renamed for Test Automation scripts
Harsh-Microsoft Jun 2, 2025
2407c5c
Update test automation workflow to use updated variable names
Harsh-Microsoft Jun 3, 2025
24fd220
commenting path for testing
Harsh-Microsoft Jun 3, 2025
7c12681
Re-enable paths for e2e-test in test automation workflow
Harsh-Microsoft Jun 3, 2025
6c73b0d
fix email body formatting
Harsh-Microsoft Jun 3, 2025
b772d74
Re-enable paths for e2e-test in test automation workflow
Harsh-Microsoft Jun 3, 2025
cc64239
test: Migrate test automation scripts and pipeline for Code Moderniza…
Avijit-Microsoft Jun 3, 2025
18f7b10
US:18810- Standardize Bicep Parameters for Code Modernization
VishalS-Microsoft Jun 4, 2025
e7f79bd
removed single quotes in default value
VishalS-Microsoft Jun 4, 2025
6f192b9
added gptModelVersion
VishalS-Microsoft Jun 4, 2025
2edb111
Update CustomizingAzdParameters.md
Roopan-Microsoft Jun 4, 2025
bda70eb
Update main.bicep file
VishalS-Microsoft Jun 4, 2025
e1d534e
Merge branch 'psl-us18810-codmod' of https://github.com/microsoft/Mod…
VishalS-Microsoft Jun 4, 2025
0ff6ab4
Merge pull request #117 from microsoft/psl-us18810-codmod
Roopan-Microsoft Jun 4, 2025
644f4ba
Add quota validation scripts and update Azure configuration for AI mo…
Abdul-Microsoft Jun 5, 2025
155b9ba
Update environment variable references for AI service location in val…
Abdul-Microsoft Jun 5, 2025
293c865
Update AI model deployment capacity to 200
Abdul-Microsoft Jun 5, 2025
b2dd86e
Update preferred regions in quota validation scripts
Abdul-Microsoft Jun 5, 2025
7e4530d
Update default regions in quota_check_params.sh
Abdul-Microsoft Jun 5, 2025
56e058b
updated main.json file
Abdul-Microsoft Jun 5, 2025
b592405
Merge pull request #119 from microsoft/quota-auto-validation
Roopan-Microsoft Jun 5, 2025
b6ab9fd
Merge branch 'main' into dev
Roopan-Microsoft Jun 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,26 @@
"image": "mcr.microsoft.com/devcontainers/python:3.11-bullseye",
"forwardPorts": [50505],
"features": {
"ghcr.io/azure/azure-dev/azd:latest": {}
"ghcr.io/azure/azure-dev/azd:latest": {},
"ghcr.io/devcontainers/features/azure-cli:1": {
"installBicep": true,
"version": "latest",
"bicepVersion": "latest"
}
},
"customizations": {
"vscode": {
"extensions": [
"ms-azuretools.azure-dev",
"ms-azuretools.vscode-azcli",
"ms-azuretools.vscode-bicep",
"ms-python.python",
"ms-toolsai.jupyter",
"GitHub.vscode-github-actions"
]
}
},
"postCreateCommand": "sudo chmod +x ./scripts/quota_check_params.sh",
"postStartCommand": "git pull origin main && python3 -m pip install -r ./src/frontend/requirements.txt && python3 -m pip install -r ./src/backend/requirements.txt",
"remoteUser": "vscode",
"hostRequirements": {
Expand Down
131 changes: 131 additions & 0 deletions .github/workflows/test-automation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: Test Automation Code Modernization

on:
push:
branches:
- main
- dev
paths:
- 'tests/e2e-test/**'
schedule:
- cron: '0 13 * * *' # Runs at 1 PM UTC
workflow_dispatch:

env:
url: ${{ vars.CODEMOD_WEB_URL }}
accelerator_name: "Code Modernization"

jobs:
test:

runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.13'

- name: Azure CLI Login
uses: azure/login@v2
with:
creds: '{"clientId":"${{ secrets.AZURE_CLIENT_ID }}","clientSecret":"${{ secrets.AZURE_CLIENT_SECRET }}","subscriptionId":"${{ secrets.AZURE_SUBSCRIPTION_ID }}","tenantId":"${{ secrets.AZURE_TENANT_ID }}"}'

- name: Start Container App
id: start-container-app
uses: azure/cli@v2
with:
azcliversion: 'latest'
inlineScript: |
az rest -m post -u "/subscriptions/${{ secrets.AZURE_SUBSCRIPTION_ID }}/resourceGroups/${{ vars.CODEMOD_RG }}/providers/Microsoft.App/containerApps/${{ vars.CODEMOD_FRONTEND_CONTAINER_NAME }}/start?api-version=2025-01-01"
az rest -m post -u "/subscriptions/${{ secrets.AZURE_SUBSCRIPTION_ID }}/resourceGroups/${{ vars.CODEMOD_RG }}/providers/Microsoft.App/containerApps/${{ vars.CODEMOD_BACKEND_CONTAINER_NAME }}/start?api-version=2025-01-01"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r tests/e2e-test/requirements.txt

- name: Ensure browsers are installed
run: python -m playwright install --with-deps chromium

- name: Run tests(1)
id: test1
run: |
xvfb-run pytest --headed --html=report/report.html --self-contained-html
working-directory: tests/e2e-test
continue-on-error: true

- name: Sleep for 30 seconds
if: ${{ steps.test1.outcome == 'failure' }}
run: sleep 30s
shell: bash

- name: Run tests(2)
id: test2
if: ${{ steps.test1.outcome == 'failure' }}
run: |
xvfb-run pytest --headed --html=report/report.html --self-contained-html
working-directory: tests/e2e-test
continue-on-error: true

- name: Sleep for 60 seconds
if: ${{ steps.test2.outcome == 'failure' }}
run: sleep 60s
shell: bash

- name: Run tests(3)
id: test3
if: ${{ steps.test2.outcome == 'failure' }}
run: |
xvfb-run pytest --headed --html=report/report.html --self-contained-html
working-directory: tests/e2e-test

- name: Upload test report
id: upload_report
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: test-report
path: tests/e2e-test/report/*

- name: Send Notification
if: always()
run: |
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
REPORT_URL=${{ steps.upload_report.outputs.artifact-url }}
IS_SUCCESS=${{ steps.test1.outcome == 'success' || steps.test2.outcome == 'success' || steps.test3.outcome == 'success' }}
# Construct the email body
if [ "$IS_SUCCESS" = "true" ]; then
EMAIL_BODY=$(cat <<EOF
{
"body": "<p>Dear Team,</p><p>We would like to inform you that the ${{ env.accelerator_name }} Test Automation process has completed successfully.</p><p><strong>Run URL:</strong> <a href=\"${RUN_URL}\">${RUN_URL}</a><br></p><p><strong>Test Report:</strong> <a href=\"${REPORT_URL}\">${REPORT_URL}</a></p><p>Best regards,<br>Your Automation Team</p>",
"subject": "${{ env.accelerator_name }} Test Automation - Success"
}
EOF
)
else
EMAIL_BODY=$(cat <<EOF
{
"body": "<p>Dear Team,</p><p>We would like to inform you that the ${{ env.accelerator_name }} Test Automation process has encountered an issue and has failed to complete successfully.</p><p><strong>Run URL:</strong> <a href=\"${RUN_URL}\">${RUN_URL}</a><br></p><p><strong>Test Report:</strong> <a href=\"${REPORT_URL}\">${REPORT_URL}</a></p><p>Please investigate the matter at your earliest convenience.</p><p>Best regards,<br>Your Automation Team</p>",
"subject": "${{ env.accelerator_name }} Test Automation - Failure"
}
EOF
)
fi

# Send the notification
curl -X POST "${{ secrets.EMAILNOTIFICATION_LOGICAPP_URL_TA }}" \
-H "Content-Type: application/json" \
-d "$EMAIL_BODY" || echo "Failed to send notification"

- name: Stop Container App
if: always()
uses: azure/cli@v2
with:
azcliversion: 'latest'
inlineScript: |
az rest -m post -u "/subscriptions/${{ secrets.AZURE_SUBSCRIPTION_ID }}/resourceGroups/${{ vars.CODEMOD_RG }}/providers/Microsoft.App/containerApps/${{ vars.CODEMOD_FRONTEND_CONTAINER_NAME }}/stop?api-version=2025-01-01"
az rest -m post -u "/subscriptions/${{ secrets.AZURE_SUBSCRIPTION_ID }}/resourceGroups/${{ vars.CODEMOD_RG }}/providers/Microsoft.App/containerApps/${{ vars.CODEMOD_BACKEND_CONTAINER_NAME }}/stop?api-version=2025-01-01"
az logout
28 changes: 22 additions & 6 deletions azure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,35 @@ name: modernize-your-code-solution-accelerator
metadata:
template: modernize-your-code-solution-accelerator@1.0
parameters:
AiLocation:
AzureAiServiceLocation:
type: string
default: japaneast
ResourcePrefix:
Prefix:
type: string
default: bs-azdtest
default: azdtemp
baseUrl:
type: string
default: 'https://raw.githubusercontent.com/microsoft/Modernize-your-code-solution-accelerator'
deployment:
mode: Incremental
template: ./infra/main.bicep # Path to the main.bicep file inside the 'deployment' folder
prameters:
AiLocation: ${{ parameters.AiLocation }}
ResourcePrefix: ${{ parameters.ResourcePrefix }}
parameters:
AzureAiServiceLocation: ${{ parameters.AzureAiServiceLocation }}
Prefix: ${{ parameters.Prefix }}
baseUrl: ${{ parameters.baseUrl }}
hooks:
preprovision:
posix:
shell: sh
run: >
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 --subscription "$AZURE_SUBSCRIPTION_ID" --location "${AZURE_AISERVICE_LOCATION:-japaneast}" --models-parameter "aiModelDeployments"
interactive: false
continueOnError: false

windows:
shell: pwsh
run: >
$location = if ($env:AZURE_AISERVICE_LOCATION) { $env:AZURE_AISERVICE_LOCATION } else { "japaneast" };
./scripts/validate_model_deployment_quota.ps1 -SubscriptionId $env:AZURE_SUBSCRIPTION_ID -Location $location -ModelsParameter "aiModelDeployments"
interactive: false
continueOnError: false
36 changes: 23 additions & 13 deletions docs/CustomizingAzdParameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,38 @@

By default this template will use the environment name as the prefix to prevent naming collisions within Azure. The parameters below show the default values. You only need to run the statements below if you need to change the values.

> To override any of the parameters, run `azd env set <PARAMETER_NAME> <VALUE>` before running `azd up`. On the first azd command, it will prompt you for the environment name. Be sure to choose 3-20 characters alphanumeric unique name.

> To override any of the parameters, run `azd env set <key> <value>` before running `azd up`. On the first azd command, it will prompt you for the environment name. Be sure to choose 3-20 characters alphanumeric unique name.
## Parameters

Change the Model Deployment Type (allowed values: Standard, GlobalStandard)
| Name | Type | Default Value | Purpose |
| -------------------------------------- | ------- | ---------------- | ---------------------------------------------------------------------------------------------------- |
| `AZURE_ENV_NAME` | string | `azdtemp` | Used as a prefix for all resource names to ensure uniqueness across environments. |
| `AZURE_LOCATION` | string | `japaneast` | Location of the Azure resources. Controls where the infrastructure will be deployed. |
| `AZURE_ENV_MODEL_DEPLOYMENT_TYPE` | string | `GlobalStandard` | Change the Model Deployment Type (allowed values: Standard, GlobalStandard). |
| `AZURE_ENV_MODEL_NAME` | string | `gpt-4o` | Set the Model Name (allowed values: gpt-4o). |
| `AZURE_ENV_MODEL_VERSION` | string | `2024-08-06` | Set the Azure model version (allowed values: 2024-08-06) |
| `AZURE_ENV_MODEL_CAPACITY` | integer | `200` | Set the Model Capacity (choose a number based on available GPT model capacity in your subscription). |
| `AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID` | string | `<Existing Workspace Id>` | Set this if you want to reuse an existing Log Analytics Workspace instead of creating a new one. |
| `AZURE_ENV_IMAGETAG` | string | `latest` | Set the Image tag Like (allowed values: latest, dev, hotfix) |

```shell
azd env set AZURE_ENV_MODEL_DEPLOYMENT_TYPE Standard
```

Set the Model Name (allowed values: gpt-4)
---

```shell
azd env set AZURE_ENV_MODEL_NAME gpt-4
```
## How to Set a Parameter

Change the Model Capacity (choose a number based on available GPT model capacity in your subscription)
To customize any of the above values, run the following command **before** `azd up`:

```shell
azd env set AZURE_ENV_MODEL_CAPACITY 30
```bash
azd env set <PARAMETER_NAME> <VALUE>
```

Set the Log Analytics Workspace Id if you need to reuse the existing workspace which is already existing
```shell
azd env set AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID '/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.OperationalInsights/workspaces/<workspace-name>'
```

**Example:**

```bash
azd env set AZURE_LOCATION westus2
```
6 changes: 3 additions & 3 deletions docs/EXAMPLE-CustomizingAzdParameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
By default this template will use the environment name as the prefix to prevent naming collisions within Azure. The parameters below show the default values. You only need to run the statements below if you need to change the values.


> To override any of the parameters, run `azd env set <key> <value>` before running `azd up`. On the first azd command, it will prompt you for the environment name. Be sure to choose 3-20 charaters alphanumeric unique name.
> To override any of the parameters, run `azd env set <key> <value>` before running `azd up`. On the first azd command, it will prompt you for the environment name. Be sure to choose 3-20 characters alphanumeric unique name.

Change the Content Understanding Location (allowed values: Sweden Central, Australia East)

Expand All @@ -17,10 +17,10 @@ Change the Model Deployment Type (allowed values: Standard, GlobalStandard)
azd env set AZURE_ENV_MODEL_DEPLOYMENT_TYPE GlobalStandard
```

Set the Model Name (allowed values: gpt-4o-mini, gpt-4o, gpt-4)
Set the Model Name (allowed values: gpt-4o)

```shell
azd env set AZURE_ENV_MODEL_NAME gpt-4o-mini
azd env set AZURE_ENV_MODEL_NAME gpt-4o
```

Change the Model Capacity (choose a number based on available GPT model capacity in your subscription)
Expand Down
16 changes: 15 additions & 1 deletion infra/deploy_ai_foundry.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ var aiHubFriendlyName = azureAiHubName
var aiHubDescription = 'AI Hub for KM template'
var aiProjectName = '${abbrs.ai.aiHubProject}${solutionName}'
var aiProjectFriendlyName = aiProjectName
var aiSearchName = '${abbrs.ai.aiSearch}${solutionName}'
var aiSearchName = '${solutionName}-search'
var applicationInsightsName = '${solutionName}-appi'



resource keyVault 'Microsoft.KeyVault/vaults@2022-07-01' existing = {
Expand All @@ -57,6 +59,17 @@ resource logAnalytics 'Microsoft.OperationalInsights/workspaces@2023-09-01' = if
}
}

resource applicationInsights 'Microsoft.Insights/components@2020-02-02' = {
name: applicationInsightsName
location: location
kind: 'web'
properties: {
Application_Type: 'web'
publicNetworkAccessForIngestion: 'Enabled'
publicNetworkAccessForQuery: 'Enabled'
WorkspaceResourceId: logAnalytics.id
}
}

var storageNameCleaned = replace(replace(replace(replace('${storageName}cast', '-', ''), '_', ''), '.', ''),'/', '')

Expand Down Expand Up @@ -318,5 +331,6 @@ output storageAccountName string = storageNameCleaned

output logAnalyticsId string = useExisting ? existingLogAnalyticsWorkspace.id : logAnalytics.id
output storageAccountId string = storage.id
output applicationInsightsConnectionString string = applicationInsights.properties.ConnectionString

output projectConnectionString string = '${split(aiHubProject.properties.discoveryUrl, '/')[2]};${subscription().subscriptionId};${resourceGroup().name};${aiHubProject.name}'
Loading