Skip to content
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
4f36121
Remove OpenAI API call from app.py
NirajC-Microsoft Nov 4, 2025
89b7912
resolve pylint issues in app.py
NirajC-Microsoft Nov 4, 2025
f033e81
update test_app.py file for init_openai method
NirajC-Microsoft Nov 4, 2025
6887b78
update app.py to pass test file
NirajC-Microsoft Nov 4, 2025
6189680
Fix for test file
NirajC-Microsoft Nov 5, 2025
c1325e8
disable soft delete
NirajC-Microsoft Nov 5, 2025
20b125b
fetch upload/download data from block storage instead of data lake
NirajC-Microsoft Nov 5, 2025
ea2c82a
remove unnecessary flags
NirajC-Microsoft Nov 5, 2025
d2e4731
Remove OpenAI API call reference from chat_with_data_plugin.py file
NirajC-Microsoft Nov 6, 2025
e1176ce
Remove unuse imports
NirajC-Microsoft Nov 6, 2025
5a71a5f
Update SampleQuestions.md with response time note (#736)
Thanusree-Microsoft Nov 6, 2025
7910fed
remove openai from requirements.txt
NirajC-Microsoft Nov 6, 2025
32d2ce4
updated test file
NirajC-Microsoft Nov 6, 2025
797ea8b
fix: update API version to 2025-04-01 and adjust skuCapacity in main.…
Pavan-Microsoft Nov 7, 2025
52e6cd6
fix: rename deploymentType parameter to gptModelDeploymentType for cl…
Pavan-Microsoft Nov 7, 2025
3cddee5
fix: Re-query data after updating sample data to refresh rows (#739)
UtkarshMishra-Microsoft Nov 7, 2025
e38bdff
fix: clarify skuCapacity comment in main.bicep for WAF deployment
Pavan-Microsoft Nov 7, 2025
f09167f
fix: update skuCapacity configuration for WAF deployment to ensure co…
Pavan-Microsoft Nov 7, 2025
9bd4885
Merge pull request #738 from microsoft/psl-pk-scaleinstance
Prajwal-Microsoft Nov 7, 2025
4e14e12
Infra changes for OpenAI API call replacement
NirajC-Microsoft Nov 11, 2025
185aa7b
refactor: Replace OpenAI API call with Foundry SDK
Avijit-Microsoft Nov 11, 2025
5667d76
revert changes
NirajC-Microsoft Nov 11, 2025
bfe8a21
revert changes - 1
NirajC-Microsoft Nov 11, 2025
fc45156
add logic for both avm and bicep deployment
NirajC-Microsoft Nov 12, 2025
d7d7f6c
Merge pull request #734 from microsoft/psl-bug-25896
Prajwal-Microsoft Nov 12, 2025
63d756d
feat: Enhance Developer Experience Support in Client Advisor (#735)
Kanchan-Microsoft Nov 12, 2025
8c73dac
Add azure-ai-projects and azure-ai-inference to requirement.txt fine …
NirajC-Microsoft Nov 12, 2025
c10f3ba
Add azure-ai-projects and azure-ai-inference to requirement.txt fine …
NirajC-Microsoft Nov 12, 2025
ea5a2e5
fix: Add azure-ai-projects and azure-ai-inference to requirement.txt …
Avijit-Microsoft Nov 12, 2025
5023139
Enable Key Vault while running post deployment script
NirajC-Microsoft Nov 17, 2025
8d4298e
Merge pull request #749 from microsoft/psl-fixpostdeployment-script1
Prajwal-Microsoft Nov 17, 2025
331bd04
fix: display previous meeting dates when asked “Provide details of la…
Rafi-Microsoft Nov 19, 2025
cb66abc
feat: Centralize SQL role assignment in run_create_index_scripts.sh a…
Abdul-Microsoft Nov 19, 2025
eabb739
Removed pre-requisite sqlcmd installation from Deployment Guide
Abdul-Microsoft Nov 19, 2025
059dfa7
Merge pull request #753 from microsoft/psl-fdpobugfix
Prajwal-Microsoft Nov 20, 2025
ff09a28
feat: Add support for developer experience (#762)
Kanchan-Microsoft Nov 25, 2025
040483c
resolved conflicts (#763)
Kanchan-Microsoft Nov 25, 2025
6a0a6bb
Merge branch 'main' into dev
Kanchan-Microsoft Nov 25, 2025
f30300b
Merge branch 'dev' of https://github.com/microsoft/Build-your-own-cop…
Kanchan-Microsoft Nov 25, 2025
b0e4265
regenerated main.json
Kanchan-Microsoft Nov 25, 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
327 changes: 327 additions & 0 deletions azure_custom.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,327 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json

name: build-your-own-copilot-solution-accelerator

requiredVersions:
azd: ">= 1.18.0"

metadata:
template: [email protected]
name: [email protected]

hooks:
# Pre-package hook to set container registry variables
prepackage:
windows:
run: |
Write-Host "Setting up container registry variables..." -ForegroundColor Green

# Get the ACR name from the deployed infrastructure
$acrName = azd env get-values --output json | ConvertFrom-Json | Select-Object -ExpandProperty "AZURE_CONTAINER_REGISTRY_NAME" -ErrorAction SilentlyContinue

if ($acrName) {
Write-Host "Using deployed ACR: $acrName" -ForegroundColor Cyan
azd env set AZURE_CONTAINER_REGISTRY_ENDPOINT "$acrName.azurecr.io"
azd env set AZURE_CONTAINER_REGISTRY_NAME $acrName
} else {
Write-Host "Warning: ACR not found in environment. Make sure infrastructure is deployed first." -ForegroundColor Yellow
}
shell: pwsh
continueOnError: true

posix:
run: |
echo "Setting up container registry variables..."

# Get the ACR name from the deployed infrastructure
ACR_NAME=$(azd env get-values --output json | jq -r '.AZURE_CONTAINER_REGISTRY_NAME // empty')

if [ ! -z "$ACR_NAME" ]; then
echo "Using deployed ACR: $ACR_NAME"
azd env set AZURE_CONTAINER_REGISTRY_ENDPOINT "$ACR_NAME.azurecr.io"
azd env set AZURE_CONTAINER_REGISTRY_NAME "$ACR_NAME"
else
echo "Warning: ACR not found in environment. Make sure infrastructure is deployed first."
fi
shell: sh
continueOnError: true

# Pre-deploy hook to build and push containers
predeploy:
windows:
run: |
Write-Host "🚀 Starting container deployment process..." -ForegroundColor Green

# Get environment variables from azd
$acrName = azd env get-value AZURE_CONTAINER_REGISTRY_NAME
$resourceGroup = azd env get-value AZURE_RESOURCE_GROUP
$webAppName = azd env get-value WEB_APP_NAME
$imageName = "byc-wa-app"
$imageTag = "latest"

if (-not $acrName) {
Write-Host "❌ Error: AZURE_CONTAINER_REGISTRY_NAME not set. Run 'azd provision' first." -ForegroundColor Red
exit 1
}

if (-not $resourceGroup) {
Write-Host "❌ Error: AZURE_RESOURCE_GROUP not set. Run 'azd provision' first." -ForegroundColor Red
exit 1
}

if (-not $webAppName) {
Write-Host "❌ Error: WEB_APP_NAME not set. Run 'azd provision' first." -ForegroundColor Red
exit 1
}

Write-Host "📋 Configuration:" -ForegroundColor Cyan
Write-Host " ACR Name: $acrName" -ForegroundColor White
Write-Host " Resource Group: $resourceGroup" -ForegroundColor White
Write-Host " Web App: $webAppName" -ForegroundColor White
Write-Host " Image: $imageName`:$imageTag" -ForegroundColor White

# Login to ACR
Write-Host "🔐 Logging into ACR..." -ForegroundColor Yellow
az acr login --name $acrName

if ($LASTEXITCODE -ne 0) {
Write-Host "❌ Failed to login to ACR" -ForegroundColor Red
exit 1
}

# Build and push the container image
Write-Host "🏗️ Building container image..." -ForegroundColor Yellow
$fullImageName = "$acrName.azurecr.io/$imageName`:$imageTag"
docker build -f "./src/App/WebApp.Dockerfile" -t $fullImageName "./src"

if ($LASTEXITCODE -ne 0) {
Write-Host "❌ Failed to build container image" -ForegroundColor Red
exit 1
}

Write-Host "📤 Pushing container image to ACR..." -ForegroundColor Yellow
docker push $fullImageName

if ($LASTEXITCODE -ne 0) {
Write-Host "❌ Failed to push container image" -ForegroundColor Red
exit 1
}

# Update environment variables
Write-Host "🔧 Updating azd environment variables..." -ForegroundColor Yellow
azd env set CONTAINER_REGISTRY_HOSTNAME "$acrName.azurecr.io"
azd env set CONTAINER_IMAGE_NAME $imageName
azd env set IMAGE_TAG $imageTag

# Configure web app ACR authentication using managed identity
Write-Host "🔑 Configuring ACR authentication for web app..." -ForegroundColor Yellow
$webappIdentity = az webapp identity show --name $webAppName --resource-group $resourceGroup --query principalId --output tsv

if (-not $webappIdentity -or $webappIdentity -eq "null") {
Write-Host "🔄 Enabling managed identity for web app..." -ForegroundColor Yellow
$webappIdentity = az webapp identity assign --name $webAppName --resource-group $resourceGroup --query principalId --output tsv
}

Write-Host " Web app identity: $webappIdentity" -ForegroundColor White

# Assign AcrPull role to web app managed identity
Write-Host "🔐 Assigning AcrPull role to web app..." -ForegroundColor Yellow
$acrResourceId = az acr show --name $acrName --resource-group $resourceGroup --query id --output tsv
az role assignment create --assignee $webappIdentity --role AcrPull --scope $acrResourceId
if ($LASTEXITCODE -ne 0) {
Write-Host "⚠️ Role assignment may already exist" -ForegroundColor Yellow
}

# Configure web app to use ACR with managed identity
Write-Host "🔧 Configuring web app container settings..." -ForegroundColor Yellow
az webapp config appsettings set --name $webAppName --resource-group $resourceGroup --settings `
DOCKER_REGISTRY_SERVER_URL="https://$acrName.azurecr.io" `
DOCKER_ENABLE_CI=true

# Configure web app to use managed identity for ACR authentication
Write-Host "🔐 Enabling ACR managed identity authentication..." -ForegroundColor Yellow
az webapp config set --name $webAppName --resource-group $resourceGroup --acr-use-identity true

# Update web app to use the new container image
Write-Host "🚀 Updating web app container image..." -ForegroundColor Yellow
$dockerImage = "DOCKER|$fullImageName"

# Use cmd to avoid PowerShell pipe interpretation issues
$cmd = "az webapp config set --name `"$webAppName`" --resource-group `"$resourceGroup`" --linux-fx-version `"$dockerImage`""
cmd /c $cmd

if ($LASTEXITCODE -ne 0) {
Write-Host "❌ Failed to update web app configuration" -ForegroundColor Red
exit 1
}

# Restart the web app to ensure it picks up the new configuration
Write-Host "🔄 Restarting web app..." -ForegroundColor Yellow
az webapp restart --name $webAppName --resource-group $resourceGroup

Write-Host "✅ Container deployment completed successfully!" -ForegroundColor Green
Write-Host "🌐 Web app URL: https://$webAppName.azurewebsites.net" -ForegroundColor Cyan
Write-Host "📦 Container image: $fullImageName" -ForegroundColor Cyan

Write-Host ""
Write-Host "⏳ The web app may take a few minutes to start up with the new container..." -ForegroundColor Yellow
Write-Host " You can monitor the logs with:" -ForegroundColor White
Write-Host " az webapp log tail --name $webAppName --resource-group $resourceGroup" -ForegroundColor Cyan
shell: pwsh
continueOnError: false

posix:
run: |
echo "🚀 Starting container deployment process..."

# Get environment variables from azd
ACR_NAME=$(azd env get-value AZURE_CONTAINER_REGISTRY_NAME)
RESOURCE_GROUP=$(azd env get-value AZURE_RESOURCE_GROUP)
WEB_APP_NAME=$(azd env get-value WEB_APP_NAME)
IMAGE_TAG="latest"
IMAGE_NAME="byc-wa-app"

if [ -z "$ACR_NAME" ]; then
echo "❌ Error: AZURE_CONTAINER_REGISTRY_NAME not set. Run 'azd provision' first."
exit 1
fi

if [ -z "$RESOURCE_GROUP" ]; then
echo "❌ Error: AZURE_RESOURCE_GROUP not set. Run 'azd provision' first."
exit 1
fi

if [ -z "$WEB_APP_NAME" ]; then
echo "❌ Error: WEB_APP_NAME not set. Run 'azd provision' first."
exit 1
fi

echo "📋 Configuration:"
echo " ACR Name: $ACR_NAME"
echo " Resource Group: $RESOURCE_GROUP"
echo " Web App: $WEB_APP_NAME"
echo " Image: $IMAGE_NAME:$IMAGE_TAG"

# Login to ACR
echo "🔐 Logging into ACR..."
az acr login --name $ACR_NAME

# Build and push the container image
echo "🏗️ Building container image..."
FULL_IMAGE_NAME="$ACR_NAME.azurecr.io/$IMAGE_NAME:$IMAGE_TAG"
docker build -f "./src/App/WebApp.Dockerfile" -t $FULL_IMAGE_NAME "./src"

echo "📤 Pushing container image to ACR..."
docker push $FULL_IMAGE_NAME

# Update environment variables
echo "🔧 Updating azd environment variables..."
azd env set CONTAINER_REGISTRY_HOSTNAME "$ACR_NAME.azurecr.io"
azd env set CONTAINER_IMAGE_NAME $IMAGE_NAME
azd env set IMAGE_TAG $IMAGE_TAG

# Configure web app ACR authentication using managed identity
echo "🔑 Configuring ACR authentication for web app..."
WEBAPP_IDENTITY=$(az webapp identity show --name $WEB_APP_NAME --resource-group $RESOURCE_GROUP --query principalId --output tsv)

if [ -z "$WEBAPP_IDENTITY" ] || [ "$WEBAPP_IDENTITY" = "null" ]; then
echo "🔄 Enabling managed identity for web app..."
WEBAPP_IDENTITY=$(az webapp identity assign --name $WEB_APP_NAME --resource-group $RESOURCE_GROUP --query principalId --output tsv)
fi

echo " Web app identity: $WEBAPP_IDENTITY"

# Assign AcrPull role to web app managed identity
echo "🔐 Assigning AcrPull role to web app..."
ACR_RESOURCE_ID=$(az acr show --name $ACR_NAME --resource-group $RESOURCE_GROUP --query id --output tsv)
az role assignment create --assignee $WEBAPP_IDENTITY --role AcrPull --scope $ACR_RESOURCE_ID || echo "⚠️ Role assignment may already exist"

# Configure web app to use ACR with managed identity
echo "🔧 Configuring web app container settings..."
az webapp config appsettings set --name $WEB_APP_NAME --resource-group $RESOURCE_GROUP --settings \
DOCKER_REGISTRY_SERVER_URL="https://$ACR_NAME.azurecr.io" \
DOCKER_ENABLE_CI=true

# Configure web app to use managed identity for ACR authentication
echo "🔐 Enabling ACR managed identity authentication..."
az webapp config set --name $WEB_APP_NAME --resource-group $RESOURCE_GROUP --acr-use-identity true

# Update web app to use the new container image
echo "🚀 Updating web app container image..."
DOCKER_IMAGE="DOCKER|$FULL_IMAGE_NAME"
az webapp config set --name $WEB_APP_NAME --resource-group $RESOURCE_GROUP --linux-fx-version "$DOCKER_IMAGE"

# Restart the web app to ensure it picks up the new configuration
echo "🔄 Restarting web app..."
az webapp restart --name $WEB_APP_NAME --resource-group $RESOURCE_GROUP

echo "✅ Container deployment completed successfully!"
echo "🌐 Web app URL: https://$WEB_APP_NAME.azurewebsites.net"
echo "📦 Container image: $FULL_IMAGE_NAME"

echo ""
echo "⏳ The web app may take a few minutes to start up with the new container..."
echo " You can monitor the logs with:"
echo " az webapp log tail --name $WEB_APP_NAME --resource-group $RESOURCE_GROUP"
shell: sh
continueOnError: false

postprovision:
windows:
run: |
Write-Host "Deployment completed successfully!" -ForegroundColor Green
Write-Host "Web app URL: " -NoNewline
Write-Host "$env:WEB_APP_URL" -ForegroundColor Cyan
Write-Host ""
Write-Host "Container Registry: " -NoNewline
Write-Host "$env:AZURE_CONTAINER_REGISTRY_NAME.azurecr.io" -ForegroundColor Cyan
Write-Host ""
Write-Host "Next step:" -ForegroundColor Yellow
Write-Host " Run the following command to grant permissions and load sample data:" -ForegroundColor White
Write-Host " bash ./infra/scripts/process_sample_data.sh $env:AZURE_RESOURCE_GROUP" -ForegroundColor Cyan
Write-Host ""
shell: pwsh
continueOnError: false
interactive: true

posix:
run: |
echo "Deployment completed successfully!"
echo "Web app URL: $WEB_APP_URL"
echo ""
echo "Container Registry: $AZURE_CONTAINER_REGISTRY_NAME.azurecr.io"
echo ""
echo "Next step:"
echo " Run the following command to grant permissions and load sample data:"
echo " bash ./infra/scripts/process_sample_data.sh $AZURE_RESOURCE_GROUP"
echo ""
shell: sh
continueOnError: false
interactive: true

postdeploy:
windows:
run: |
Write-Host "✅ Deployment completed! Container deployment was handled by predeploy hook." -ForegroundColor Green
$webAppUrl = azd env get-value WEB_APP_URL
Write-Host "🌐 Web app URL: $webAppUrl" -ForegroundColor Cyan
shell: pwsh
continueOnError: true

posix:
run: |
echo "✅ Deployment completed! Container deployment was handled by predeploy hook."
WEB_APP_URL=$(azd env get-value WEB_APP_URL)
echo "🌐 Web app URL: $WEB_APP_URL"
shell: sh
continueOnError: true

# Infrastructure configuration
infra:
provider: bicep
path: infra
module: main
parameters:
containerRegistryHostname: ${CONTAINER_REGISTRY_HOSTNAME=""}
containerImageName: ${CONTAINER_IMAGE_NAME="byc-wa-app"}
imageTag: ${IMAGE_TAG="latest"}
7 changes: 7 additions & 0 deletions docs/DeploymentGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,13 @@ This will rebuild the source code, package it into a container, and push it to t
### 🛠️ Troubleshooting
If you encounter any issues during the deployment process, please refer [troubleshooting](../docs/TroubleShootingSteps.md) document for detailed steps and solutions

## Deploy Your local changes
To deploy your local changes rename the below files.
1. Rename `azure.yaml` to `azure_custom2.yaml` and `azure_custom.yaml` to `azure.yaml`.
2. Go to `infra` directory
- Rename `main.bicep` to `main_custom2.bicep` and `main_custom.bicep` to `main.bicep`.
Continue with the [deploying steps](#deploying-with-azd).

## Post Deployment Steps

### 1. Import Sample Data
Expand Down
2 changes: 2 additions & 0 deletions docs/SampleQuestions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

To help you get started, here are some **Sample Prompts** you can ask after selecting the **Karen Berg** client:

> _Note: Average response time is 08-30 seconds._ <br>

1. Click on **Karen Berg** client.
2. Ask the following questions:
- What were Karen's concerns during our last meeting?
Expand Down
Loading
Loading