Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Each line is a file pattern followed by one or more owners.

# These owners will be the default owners for everything in the repo.
* @Avijit-Microsoft @Roopan-Microsoft @Prajwal-Microsoft @aniaroramsft @Vinay-Microsoft @malrose07 @toherman-msft @nchandhi
* @Avijit-Microsoft @Roopan-Microsoft @Prajwal1-Microsoft @aniaroramsft @VinaySh-Microsoft @malrose07 @toherman-msft @nchandhi
99 changes: 16 additions & 83 deletions azure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,98 +55,31 @@ hooks:
postprovision:
windows:
run: |
Write-Host "===== Provision Complete =====" -ForegroundColor Green
Write-Host ""
Write-Host "Web App URL: " -NoNewline
Write-Host "$env:WEB_APP_URL" -ForegroundColor Cyan
Write-Host "Storage Account: " -NoNewline
Write-Host "$env:AZURE_BLOB_ACCOUNT_NAME" -ForegroundColor Cyan
Write-Host "AI Search Service: " -NoNewline
Write-Host "$env:AI_SEARCH_SERVICE_NAME" -ForegroundColor Cyan
Write-Host "AI Search Index: " -NoNewline
Write-Host "$env:AZURE_AI_SEARCH_PRODUCTS_INDEX" -ForegroundColor Cyan
Write-Host "AI Service Location: " -NoNewline
Write-Host "$env:AZURE_ENV_AI_SERVICE_LOCATION" -ForegroundColor Cyan
Write-Host "Container Instance: " -NoNewline
Write-Host "$env:CONTAINER_INSTANCE_NAME" -ForegroundColor Cyan

# Run post-deploy script to upload sample data and create search index
Write-Host ""
# Note: Cosmos DB role is assigned to deployer via Bicep.
Write-Host "===== Running Post-Deploy Script =====" -ForegroundColor Yellow
Write-Host "This will upload sample data and create the search index..."
Write-Host "===== Provisioning Complete =====" -ForegroundColor Green
Write-Host "Run the following two scripts, in order:" -ForegroundColor Yellow
Write-Host " 1. Build and push the application images to ACR, then update the web app and container instance:" -ForegroundColor Yellow
Write-Host " ./infra/scripts/build_and_deploy_images.ps1" -ForegroundColor Cyan
Write-Host " 2. Load the sample data into the application (run only after the previous script run has completed):" -ForegroundColor Yellow
Write-Host " ./infra/scripts/process_sample_data.ps1" -ForegroundColor Cyan
Comment thread
Harsh-Microsoft marked this conversation as resolved.

# Ensure post-deploy Python dependencies are installed
$python = "python"
if (Test-Path "./.venv/Scripts/python.exe") { $python = "./.venv/Scripts/python.exe" }
elseif (Test-Path "../.venv/Scripts/python.exe") { $python = "../.venv/Scripts/python.exe" }
elseif (Test-Path "./.venv/bin/python") { $python = "./.venv/bin/python" }
elseif (Test-Path "../.venv/bin/python") { $python = "../.venv/bin/python" }
& $python -m pip install -r ./scripts/requirements-post-deploy.txt --quiet | Out-Null

if (Test-Path "./scripts/post_deploy.py") {
& $python ./scripts/post_deploy.py --skip-tests

if ($LASTEXITCODE -eq 0) {
Write-Host "Post-deploy script completed successfully!" -ForegroundColor Green
} else {
Write-Host "Post-deploy script completed with warnings (some steps may have failed)" -ForegroundColor Yellow
}
} else {
Write-Host "Warning: post_deploy.py not found, skipping sample data upload" -ForegroundColor Yellow
}

Write-Host ""
Write-Host "===== Deployment Complete =====" -ForegroundColor Green
Write-Host ""
Write-Host "Access the web application:"
Write-Host " $env:WEB_APP_URL" -ForegroundColor Cyan
Write-Host "Web app URL: " -NoNewline
Write-Host "$env:WEB_APP_URL" -ForegroundColor Cyan
shell: pwsh
continueOnError: false
interactive: true
posix:
run: |
echo "===== Provision Complete ====="
echo ""
echo "Web App URL: $WEB_APP_URL"
echo "Storage Account: $AZURE_BLOB_ACCOUNT_NAME"
echo "AI Search Service: $AI_SEARCH_SERVICE_NAME"
echo "AI Search Index: $AZURE_AI_SEARCH_PRODUCTS_INDEX"
echo "AI Service Location: $AZURE_ENV_AI_SERVICE_LOCATION"
echo "Container Instance: $CONTAINER_INSTANCE_NAME"

echo ""
echo "Container Registry: $AZURE_ENV_CONTAINER_REGISTRY_NAME"

# Run post-deploy script to upload sample data and create search index
echo ""
# Note: Cosmos DB role is assigned to deployer via Bicep.
echo "===== Running Post-Deploy Script ====="
echo "This will upload sample data and create the search index..."

if [ -f "./scripts/post_deploy.py" ]; then
# Prefer local venv if present (repo root or content-gen)
if [ -x "./.venv/bin/python" ]; then
PYTHON_BIN="./.venv/bin/python"
elif [ -x "../.venv/bin/python" ]; then
PYTHON_BIN="../.venv/bin/python"
else
PYTHON_BIN="python3"
fi
echo "===== Provisioning Complete ====="
echo "Run the following two scripts, in order:"
echo " 1. Build and push the application images to ACR, then update the web app and container instance:"
echo " bash ./infra/scripts/build_and_deploy_images.sh"
echo " "
echo " 2. Load the sample data into the application (run only after the previous script run has completed):"
echo " bash ./infra/scripts/process_sample_data.sh"
Comment thread
Harsh-Microsoft marked this conversation as resolved.

"$PYTHON_BIN" -m pip install -r ./scripts/requirements-post-deploy.txt --quiet > /dev/null \
&& "$PYTHON_BIN" ./scripts/post_deploy.py --skip-tests \
&& echo "Post-deploy script completed successfully!" \
|| echo "Post-deploy script completed with warnings (some steps may have failed)"
else
echo "Warning: post_deploy.py not found, skipping sample data upload"
fi

echo ""
echo "===== Deployment Complete ====="
echo ""
echo "Access the web application:"
echo " $WEB_APP_URL"
echo "Web app URL: $WEB_APP_URL"
shell: sh
continueOnError: false
interactive: true
83 changes: 71 additions & 12 deletions docs/AZD_DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,67 @@ azd config set provision.preflight off
azd up
```

This single command will:
1. **Provision** all Azure resources (AI Services, Cosmos DB, Storage, AI Search, App Service, Container Registry)
2. **Build** the Docker container image and push to ACR
3. **Deploy** the container to Azure Container Instances
4. **Build** the frontend (React/TypeScript)
5. **Deploy** the frontend to App Service
6. **Configure** RBAC and Cosmos DB roles
7. **Upload** sample data and create the search index
This command will **provision** all Azure resources (AI Services, Cosmos DB, Storage, AI Search, App Service, Container Instance, Container Registry) and configure RBAC and Cosmos DB roles. The Container Registry (ACR) is initially deployed with placeholder images; the application images are built and pushed by the follow-up scripts below.

When provisioning completes, the terminal prints the two follow-up scripts you must run, **in order**, to finish the deployment.

### 5. Log in to Azure CLI

These scripts use the Azure CLI, so log in first:

```bash
az login
```

Alternatively, log in using a device code (**recommended when using VS Code Web**):

```bash
az login --use-device-code
```

> **Note:** If you are running this deployment in **GitHub Codespaces**, a **VS Code Dev Container**, or **VS Code Web**, skip this step and continue with [step 7](#7-run-the-script-to-build-and-push-the-application-images).

### 6. Create and activate a Python virtual environment

```powershell
# PowerShell (Windows)
python -m venv .venv
.venv\Scripts\Activate.ps1
```

```bash
# Bash (macOS/Linux, or Git Bash on Windows)
python -m venv .venv
source .venv/bin/activate # on Git Bash (Windows): source .venv/Scripts/activate
```

### 7. Run the script to build and push the application images

Build and push the frontend and backend images to ACR, then update the App Service and Container Instance:

```powershell
# PowerShell
./infra/scripts/build_and_deploy_images.ps1
```

```bash
# Bash
bash ./infra/scripts/build_and_deploy_images.sh
```

### 8. Run the script to load the sample data (script 2)

Run this **only after step 7 has completed** — it loads the sample data into the application:

Comment thread
Harsh-Microsoft marked this conversation as resolved.
```powershell
# PowerShell
./infra/scripts/process_sample_data.ps1
```

```bash
# Bash
bash ./infra/scripts/process_sample_data.sh
```

## Using Existing Resources

Expand All @@ -146,15 +199,21 @@ azd env set AZURE_ENV_EXISTING_LOG_ANALYTICS_WORKSPACE_RID "/subscriptions/<sub-

## Post-Deployment

After `azd up` completes, you'll see output like:
After `azd up` completes, the terminal prints the provisioning summary and the two follow-up scripts to run:

```
===== Deployment Complete =====
===== Provisioning Complete =====
Run the following two scripts, in order:
1. Build and push the application images to ACR, then update the web app and container instance:
./infra/scripts/build_and_deploy_images.ps1
2. Load the sample data into the application (run only after the previous script run has completed):
./infra/scripts/process_sample_data.ps1
Comment thread
Harsh-Microsoft marked this conversation as resolved.

Access the web application:
https://app-<env-name>.azurewebsites.net
Web app URL: https://app-<env-name>.azurewebsites.net
```

Run those two scripts as described in [steps 5–8](#5-log-in-to-azure-cli) above, then verify the deployment.

### Verify Deployment

1. Open the Web App URL in your browser
Expand Down
2 changes: 2 additions & 0 deletions docs/DEPLOYMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ Depending on your subscription quota and capacity, you can adjust quota settings

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 the steps in the [AZD Deployment Guide](AZD_DEPLOYMENT.md).

> **Important:** `azd up` only **provisions** the Azure resources (the Container Registry is created with placeholder images). Once provisioning completes, you must run the **two follow-up scripts**, in order - first `build_and_deploy_images` (builds and pushes the application images to ACR and updates the App Service and Container Instance), then `process_sample_data` (loads the sample data). See [Post-Provision Scripts (steps 5–8)](AZD_DEPLOYMENT.md#5-log-in-to-azure-cli) for details.
Comment thread
Harsh-Microsoft marked this conversation as resolved.

## Post Deployment Steps

1. **Add App Authentication**
Expand Down
Loading
Loading