Deploy the AgriValue backend to Azure App Service so GitHub Pages can call live Foundry IQ, Fabric lakehouse, and Work IQ APIs.
GitHub Pages (static UI) ──fetch──► Azure App Service (Node.js API)
│ │
│ config.js ├── Fabric IQ (SQL)
│ apiBase: https://xxx.azurewebsites.net ├── Foundry IQ (Azure Agent)
└─ public/ only └── Work IQ (Graph API)
az group create --name rg-agrivalue --location westeurope
az deployment group create \
--resource-group rg-agrivalue \
--template-file infra/main.bicep \
--parameters appName=agrivalue-iq-prodNote the apiUrl output (e.g. https://agrivalue-iq-prod.azurewebsites.net).
In Azure Portal → App Service → Configuration → Application settings:
| Setting | Purpose |
|---|---|
FOUNDRY_OPENAI_BASE_URL |
Foundry OpenAI v1 base URL, e.g. https://...services.ai.azure.com/openai/v1 |
FOUNDRY_MODEL_DEPLOYMENT |
Model deployment name, e.g. gpt-4o |
FOUNDRY_RESPONSES_ENDPOINT |
Foundry project agent Responses endpoint |
FOUNDRY_API_KEY |
Optional key. If omitted, App Service uses managed identity / DefaultAzureCredential |
AZURE_AI_AGENT_ID |
Legacy Azure OpenAI agent ID fallback |
AZURE_OPENAI_ENDPOINT |
Legacy Azure OpenAI endpoint fallback |
AZURE_OPENAI_API_KEY |
Legacy Azure OpenAI API key fallback |
FABRIC_SQL_SERVER |
Fabric warehouse SQL endpoint |
FABRIC_SQL_DATABASE |
Database name |
GRAPH_TENANT_ID |
Work IQ — Entra tenant |
GRAPH_CLIENT_ID |
App registration client ID |
GRAPH_CLIENT_SECRET |
Client secret |
TEAMS_TEAM_ID |
Teams team ID |
TEAMS_CHANNEL_ID |
Channel ID |
CORS_ORIGINS |
https://cdm227.github.io |
Add these repository secrets:
| Secret | Value |
|---|---|
AZURE_WEBAPP_NAME |
App name from Bicep (e.g. agrivalue-iq-prod) |
AZURE_WEBAPP_PUBLISH_PROFILE |
Download from Azure Portal → Get publish profile |
AZURE_API_URL |
https://agrivalue-iq-prod.azurewebsites.net |
Create environment azure-production in repo Settings → Environments (optional protection rules).
- Backend: Push to
PROD→.github/workflows/azure-deploy.ymldeploys full app - Frontend: Push to
PROD→.github/workflows/static.ymldeployspublic/with injectedconfig.js
- Open
https://YOUR-APP.azurewebsites.net/api/status - Open
https://cdm227.github.io/AgriValue-Tracker - IQ pills should show live Fabric/Foundry/Work status from Azure
Run infra/fabric-schema.sql in your Fabric Warehouse SQL endpoint, then set FABRIC_SQL_* env vars. The server syncs on startup and every 5 minutes.
Register an app in Entra ID with application permission ChannelMessage.Send and admin consent. Alternatively use TEAMS_WEBHOOK_URL for a simpler incoming webhook.
# Test GitHub Pages behavior locally
echo "window.AGRIVALUE_CONFIG={apiBase:'http://localhost:3000',staticFallback:false};" > public/config.js
npm start
# Open public/index.html via live server or http://localhost:3000For reviewers and public users, no shared credentials are required. The app runs with in-memory demo data unless they configure their own .env.
npm install
npm startOpen the forwarded port 3000 URL. Same-origin Codespaces URLs are allowed by the API origin gate, while unrelated external sites remain blocked.
Optional user-owned integrations:
- Foundry IQ:
FOUNDRY_OPENAI_BASE_URL,FOUNDRY_MODEL_DEPLOYMENT - Fabric IQ:
FABRIC_SQL_SERVER,FABRIC_SQL_DATABASE - Work IQ:
TEAMS_WEBHOOK_URLor Microsoft Graph app settings