Skip to content

feat: Improve Developer Experience#973

Open
Abdul-Microsoft wants to merge 13 commits into
dev-v4from
feature/local-dev-setup-automation
Open

feat: Improve Developer Experience#973
Abdul-Microsoft wants to merge 13 commits into
dev-v4from
feature/local-dev-setup-automation

Conversation

@Abdul-Microsoft
Copy link
Copy Markdown
Collaborator

Purpose

  • This pull request adds comprehensive documentation for automating both local development setup and deployment of local changes to Azure using cross-platform scripts. The documentation covers prerequisites, detailed workflows, usage examples, and troubleshooting for both processes.

Local Development Setup Documentation (AutomatedLocalSetup.md):

  • Introduces and documents two scripts (setup_local_dev.sh for Linux/macOS/WSL and setup_local_dev.ps1 for Windows PowerShell) that automate the entire local development environment setup, including Azure authentication, environment file generation, dependency installation, RBAC role assignment, and VS Code configuration.
  • Details all prerequisites, step-by-step actions performed by the scripts, command-line options, usage examples, and troubleshooting tips.

Deployment to Azure Documentation (DeployLocalChanges.md):

  • Adds documentation for two deployment scripts (deploy_to_azure.sh for Linux/macOS/WSL and deploy_to_azure.ps1 for Windows PowerShell) that detect changed services, build and push Docker images, and update Azure resources.
  • Explains prerequisites, change detection logic using git diff, ACR selection and authentication, command-line options, usage examples, and rollback instructions.

Does this introduce a breaking change?

  • Yes
  • No

How to Test

  • Get the code
git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
npm install
  • Test the code

What to Check

Verify that the following are valid

  • ...

Other Information

Abdul-Microsoft and others added 3 commits May 6, 2026 11:46
- setup_local_dev.sh/.ps1: Automates full local development setup
  - Prerequisite checks with detailed install guidance
  - Azure config fetch from Resource Group (container app or individual resources)
  - RBAC role assignment with pre-check (Cosmos DB, AI Foundry, Search, Storage)
  - Virtual environment setup for backend, MCP server, and frontend
  - VS Code settings and launch.json generation
  - Auto-fix for .venv lock issues (VS Code Python extension)

- deploy_to_azure.sh/.ps1: Deploys local code changes to Azure
  - Builds Docker images for selected services (backend, mcp, frontend)
  - Pushes to ACR with unique timestamp+git-sha tags
  - Updates Container Apps and App Service with new images
  - ACR discovery, creation, and AcrPull role assignment
  - Dry-run mode, build-only/deploy-only modes
  - Rollback commands printed after deployment

- .gitignore: Added local dev artifacts (.macae_*.pid, start_all_services.sh)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds cross-platform automation for setting up a local development environment and deploying local code changes to Azure, along with new documentation describing both workflows.

Changes:

  • Add setup_local_dev.sh / setup_local_dev.ps1 to automate local environment setup (Azure auth, .env generation, dependency install, RBAC, VS Code config).
  • Add deploy_to_azure.sh / deploy_to_azure.ps1 to build/push only changed services and update Azure resources.
  • Add new docs for both workflows and update .gitignore for local artifacts.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 20 comments.

Show a summary per file
File Description
setup_local_dev.sh Bash-based local setup automation (config discovery, env generation, RBAC, installs, VS Code config).
setup_local_dev.ps1 PowerShell-based local setup automation with similar workflow on Windows.
deploy_to_azure.sh Bash deployment helper for building/pushing images and updating Azure resources.
deploy_to_azure.ps1 PowerShell deployment helper mirroring the bash script.
docs/AutomatedLocalSetup.md New documentation for automated local setup scripts.
docs/DeployLocalChanges.md New documentation for deploying local changes scripts.
.gitignore Ignore additional local dev artifacts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread setup_local_dev.sh
Comment thread setup_local_dev.ps1
Comment thread infra/scripts/setup_local_dev.ps1
Comment thread setup_local_dev.sh Outdated
Comment thread infra/scripts/setup_local_dev.sh
Comment thread docs/AutomatedLocalSetup.md Outdated
Comment thread docs/AutomatedLocalSetup.md Outdated
Comment thread docs/AutomatedLocalSetup.md
Comment thread deploy_to_azure.ps1 Outdated
Comment thread deploy_to_azure.ps1 Outdated
Remove local dev setup artifacts from .gitignore
Copilot AI review requested due to automatic review settings May 8, 2026 12:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 9 comments.

Comment thread setup_local_dev.sh
Comment thread infra/scripts/setup_local_dev.sh
Comment thread infra/scripts/setup_local_dev.sh
Comment thread setup_local_dev.ps1
Comment thread infra/scripts/deploy_to_azure.ps1
Comment thread docs/AutomatedLocalSetup.md
Comment thread deploy_to_azure.sh Outdated
Comment thread deploy_to_azure.sh Outdated
Comment thread deploy_to_azure.ps1 Outdated
Abdul-Microsoft and others added 2 commits May 8, 2026 18:16
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Fix Write-LogWarn crash from extra -ForegroundColor parameter (deploy_to_azure.ps1)
- Fix misleading git diff warning message in both deploy scripts
- Change -r to -g short flag for --resource-group to match docs (setup_local_dev.sh)
- Gate RBAC assignment behind --assign-rbac / -AssignRbac flag (both setup scripts)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 11, 2026 06:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Comment thread infra/scripts/deploy_to_azure.sh
Comment thread infra/scripts/setup_local_dev.sh
Comment thread infra/scripts/setup_local_dev.ps1
Comment thread infra/scripts/deploy_to_azure.sh
Comment thread docs/AutomatedLocalSetup.md Outdated
Abdul-Microsoft and others added 2 commits May 11, 2026 12:16
RBAC roles are essential for local dev and should always be assigned.
The script already skips roles that are already assigned, so running
unconditionally is safe and simplifies the user experience.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Moved all 4 scripts to scripts/ directory and updated all
references in docs/AutomatedLocalSetup.md and docs/DeployLocalChanges.md.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 11, 2026 07:14
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Comment thread docs/AutomatedLocalSetup.md
Comment thread docs/AutomatedLocalSetup.md
Comment thread docs/DeployLocalChanges.md
Comment thread docs/DeployLocalChanges.md
Comment thread docs/AutomatedLocalSetup.md
Comment thread docs/DeployLocalChanges.md
Scripts now compute REPO_ROOT as two levels up from their location
in infra/scripts/, so all src/ and .azure/ paths resolve correctly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 11, 2026 08:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 10 comments.

Comment thread infra/scripts/deploy_to_azure.sh Outdated
Comment on lines +163 to +173
if command -v docker &>/dev/null; then
log_success "Docker found: $(docker --version)"
else
missing+=("docker")
fi

if command -v az &>/dev/null; then
log_success "Azure CLI found"
else
missing+=("azure-cli")
fi
Comment thread infra/scripts/deploy_to_azure.sh Outdated
log_warn "No service-specific changes detected (no uncommitted changes vs HEAD)."
echo ""
read -rp "No changes detected. Deploy all services anyway? [y/N]: " confirm
if [[ "${confirm,,}" == "y" || "${confirm,,}" == "yes" ]]; then
Comment on lines +511 to +516
log_info "Generating .env file at: $env_file"

declare -A env_vars
while IFS= read -r line; do
line="${line%%$'\r'}"
[[ -z "$line" || "$line" == \#* ]] && continue
AZURE_OPENAI_RAI_DEPLOYMENT_NAME=${env_vars[AZURE_OPENAI_RAI_DEPLOYMENT_NAME]:-gpt-4.1}
AZURE_OPENAI_API_VERSION=${env_vars[AZURE_OPENAI_API_VERSION]:-2024-12-01-preview}
REASONING_MODEL_NAME=${env_vars[REASONING_MODEL_NAME]:-o4-mini}
SUPPORTED_MODELS=${env_vars[SUPPORTED_MODELS]:-["o3","o4-mini","gpt-4.1","gpt-4.1-mini"]}
Comment on lines +875 to +883
cat > "$settings_file" << 'SETEOF'
{
"python.defaultInterpreterPath": "${workspaceFolder}/src/backend/.venv/Scripts/python.exe",
"python.terminal.activateEnvironment": true,
"python.linting.enabled": true,
"python.formatting.provider": "black",
"python.debugging.logLevel": "Debug",
"debug.inlineValues": "on",
"files.exclude": {
Comment on lines +479 to +501
COSMOSDB_ENDPOINT=$($envVars["COSMOSDB_ENDPOINT"])
COSMOSDB_DATABASE=$($envVars["COSMOSDB_DATABASE"] ?? "macae")
COSMOSDB_CONTAINER=$($envVars["COSMOSDB_CONTAINER"] ?? "memory")

# --- Azure OpenAI ---
AZURE_OPENAI_ENDPOINT=$($envVars["AZURE_OPENAI_ENDPOINT"])
AZURE_OPENAI_MODEL_NAME=$($envVars["AZURE_OPENAI_MODEL_NAME"] ?? "gpt-4.1-mini")
AZURE_OPENAI_DEPLOYMENT_NAME=$($envVars["AZURE_OPENAI_DEPLOYMENT_NAME"] ?? "gpt-4.1-mini")
AZURE_OPENAI_RAI_DEPLOYMENT_NAME=$($envVars["AZURE_OPENAI_RAI_DEPLOYMENT_NAME"] ?? "gpt-4.1")
AZURE_OPENAI_API_VERSION=$($envVars["AZURE_OPENAI_API_VERSION"] ?? "2024-12-01-preview")
REASONING_MODEL_NAME=$($envVars["REASONING_MODEL_NAME"] ?? "o4-mini")
SUPPORTED_MODELS=$($envVars["SUPPORTED_MODELS"] ?? '["o3","o4-mini","gpt-4.1","gpt-4.1-mini"]')

# --- Azure AI Foundry ---
AZURE_AI_SUBSCRIPTION_ID=$($envVars["AZURE_AI_SUBSCRIPTION_ID"])
AZURE_AI_RESOURCE_GROUP=$($envVars["AZURE_AI_RESOURCE_GROUP"])
AZURE_AI_PROJECT_NAME=$($envVars["AZURE_AI_PROJECT_NAME"])
AZURE_AI_PROJECT_ENDPOINT=$($envVars["AZURE_AI_PROJECT_ENDPOINT"])
AZURE_AI_AGENT_ENDPOINT=$($envVars["AZURE_AI_AGENT_ENDPOINT"])
AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME=$($envVars["AZURE_AI_AGENT_MODEL_DEPLOYMENT_NAME"] ?? "gpt-4.1-mini")
AZURE_AI_AGENT_API_VERSION=$($envVars["AZURE_AI_AGENT_API_VERSION"] ?? "2025-05-01-preview")
AZURE_AI_AGENT_PROJECT_CONNECTION_STRING=$($envVars["AZURE_AI_AGENT_PROJECT_CONNECTION_STRING"])
AZURE_COGNITIVE_SERVICES=$($envVars["AZURE_COGNITIVE_SERVICES"] ?? "https://cognitiveservices.azure.com/.default")
Comment on lines +866 to +867
Write-LogWarn "Execution policy is Restricted. Setting to RemoteSigned..."
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
az webapp config appsettings set --name $script:FrontendApp --resource-group $ResourceGroup `
--settings DOCKER_REGISTRY_SERVER_URL="https://$($script:AcrLoginServer)" --output none
az webapp config set --name $script:FrontendApp --resource-group $ResourceGroup `
--generic-configurations '{\"acrUseManagedIdentityCreds\": true}' --output none
Comment on lines +608 to +616
az webapp config appsettings set --name $script:FrontendApp --resource-group $ResourceGroup `
--settings DOCKER_REGISTRY_SERVER_URL="https://$($script:AcrLoginServer)" --output none
az webapp config set --name $script:FrontendApp --resource-group $ResourceGroup `
--generic-configurations '{\"acrUseManagedIdentityCreds\": true}' --output none
if ($LASTEXITCODE -ne 0) {
Write-LogError "Frontend registry config FAILED — image pull may fail."
} else {
Write-LogSuccess "Frontend registry config updated"
}
Comment thread docs/AutomatedLocalSetup.md Outdated
Comment on lines +164 to +171
# Terminal 2 — MCP Server (port 9000)
cd src/mcp_server
source .venv/Scripts/activate
python mcp_server.py

# Terminal 3 — Frontend (port 3000)
cd src/App
npm run dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants