Your application is successfully deployed to Azure:
- Function App:
func-disaster-1767817356.azurewebsites.net - Storage Account:
stgdisaster767816886(East Asia) - Table Storage:
Alertstable created - Resource Group:
disaster-response-rg - Region: East Asia (per subscription policy)
Live API Endpoint:
https://func-disaster-1767817356.azurewebsites.net/api/SubmitAlert
- ✅ Azure Student Account (free $100 credit)
- ✅ GitHub Codespaces (where you are now)
- ✅ This project files
- ✅ Azure CLI authenticated
# 1. Install dependencies
pip install -r requirements.txt
# 2. Start the function
func startStatus: ✅ Your function is running at http://localhost:7071
az login --use-device-codeaz group create \
--name disaster-response-rg \
--location eastasia # Changed from eastus due to region policyResult: Resource group created in East Asia region
Original Plan: Cosmos DB (blocked by Azure subscription policy) Solution: Azure Table Storage (simpler, more compatible with regional restrictions)
STORAGE_ACCOUNT=stgdisaster767816886
az storage account create \
--name $STORAGE_ACCOUNT \
--resource-group disaster-response-rg \
--location eastasia \
--sku Standard_LRSResult: Storage account stgdisaster767816886 created
az storage table create \
--name Alerts \
--account-name $STORAGE_ACCOUNTResult: Alerts table created
az provider register --namespace Microsoft.Web
az provider show --namespace Microsoft.Web --query "registrationState"FUNCTION_APP=func-disaster-1767817356
az functionapp create \
--name $FUNCTION_APP \
--resource-group disaster-response-rg \
--consumption-plan-location eastasia \
--runtime python \
--runtime-version 3.11 \
--functions-version 4 \
--storage-account $STORAGE_ACCOUNT \
--os-type Linuxaz functionapp config appsettings set \
--name $FUNCTION_APP \
--resource-group disaster-response-rg \
--settings \
AZURE_STORAGE_CONNECTION_STRING="$STORAGE_CONNECTION" \
TABLE_NAME=Alertscd ~/azure-disaster-response
func azure functionapp publish $FUNCTION_APP --pythoncurl -X POST https://${FUNCTION_APP}.azurewebsites.net/api/SubmitAlert \
-H "Content-Type: application/json" \
-d '{
"location": "Seattle, WA",
"type": "Flood",
"severity": "High"
}'- Azure Portal → Storage Accounts →
stgdisaster767816886→ Tables →Alerts - Or via CLI:
az storage entity query \
--table-name Alerts \
--account-name stgdisaster767816886Or use the portal:
- Go to https://portal.azure.com
- Search for "Cosmos DB"
- Click your account → Data Explorer
- Navigate to DisasterResponseDB → Alerts
- Click "Items" to see your alerts
# Install SWA CLI
npm install -g @azure/static-web-apps-cli
# Create Static Web App
az staticwebapp create \
--name swa-disaster-response \
--resource-group disaster-response-rg \
--location eastus
# Get deployment token
DEPLOYMENT_TOKEN=$(az staticwebapp secrets list \
--name swa-disaster-response \
--resource-group disaster-response-rg \
--query properties.apiKey -o tsv)
# First, update index.html with your function URL
sed -i "s|http://localhost:7071/api/SubmitAlert|https://${FUNCTION_APP}.azurewebsites.net/api/SubmitAlert|g" index.html
# Deploy
swa deploy index.html --deployment-token $DEPLOYMENT_TOKEN# Enable static website on storage account
az storage blob service-properties update \
--account-name $STORAGE_ACCOUNT \
--static-website \
--index-document index.html
# Upload index.html
az storage blob upload \
--account-name $STORAGE_ACCOUNT \
--container-name '$web' \
--name index.html \
--file index.html \
--content-type "text/html"
# Get website URL
WEBSITE_URL=$(az storage account show \
--name $STORAGE_ACCOUNT \
--resource-group disaster-response-rg \
--query "primaryEndpoints.web" -o tsv)
echo "========================="
echo "WEBSITE LIVE AT: $WEBSITE_URL"
echo "========================="# In one terminal
func start
# Take screenshot of terminal showing function running- Go to https://portal.azure.com
- Navigate to "Resource Groups" → "disaster-response-rg"
- Take screenshot showing all resources
# Stream live logs
func azure functionapp logstream $FUNCTION_APP
# Submit an alert from frontend, see it appear in logs
# Take screenshot- Portal → Cosmos DB → Your Account
- Data Explorer → DisasterResponseDB → Alerts → Items
- Take screenshot of stored alerts
- Open your website URL
- Fill out the form
- Submit an alert
- Take screenshot of success message
All within FREE TIER:
- ✅ Cosmos DB: 1000 RU/s free (sufficient for this project)
- ✅ Azure Functions: 1M executions/month free
- ✅ Storage: 5 GB free
- ✅ Static Web App: Free tier available
Expected Cost: $0/month for low usage
az group delete \
--name disaster-response-rg \
--yes \
--no-waitThis deletes:
- Cosmos DB account
- Function App
- Storage Account
- Static Web App
- All data
SubmitAlert/__init__.py(your function)index.html(frontend)requirements.txt(dependencies)host.json(configuration)
- This deployment guide
- Screenshots (5 minimum)
# Local development
pip install -r requirements.txt
func start
# Azure deployment
az login
az group create --name disaster-response-rg --location eastus
az cosmosdb create --name cosmos-disaster-xxx --resource-group disaster-response-rg
az functionapp create --name func-disaster-xxx --resource-group disaster-response-rg
func azure functionapp publish func-disaster-xxx- Architecture diagram (Function → Cosmos DB)
- Explanation of serverless benefits
- How data flows from form to database
- Why Cosmos DB was chosen (NoSQL, global distribution)
- Cost analysis (free tier compliance)
- Security considerations (CORS, authentication)
Copy-paste this entire block:
# 1. Login
az login --use-device-code
# 2. Create resource group
az group create --name disaster-response-rg --location eastus
# 3. Create Cosmos DB
COSMOS_NAME=cosmos-disaster-$(date +%s)
az cosmosdb create --name $COSMOS_NAME --resource-group disaster-response-rg \
--locations regionName=eastus --enable-free-tier true
# 4. Create database and container
az cosmosdb sql database create --account-name $COSMOS_NAME \
--resource-group disaster-response-rg --name DisasterResponseDB
az cosmosdb sql container create --account-name $COSMOS_NAME \
--resource-group disaster-response-rg --database-name DisasterResponseDB \
--name Alerts --partition-key-path "/type" --throughput 400
# 5. Get Cosmos credentials
COSMOS_ENDPOINT=$(az cosmosdb show --resource-group disaster-response-rg \
--name $COSMOS_NAME --query documentEndpoint -o tsv)
COSMOS_KEY=$(az cosmosdb keys list --resource-group disaster-response-rg \
--name $COSMOS_NAME --query primaryMasterKey -o tsv)
# 6. Create storage account
STORAGE_NAME=stgdisaster$(date +%s | tail -c 10)
az storage account create --name $STORAGE_NAME \
--resource-group disaster-response-rg --location eastus --sku Standard_LRS
# 7. Create Function App
FUNCTION_NAME=func-disaster-$(date +%s)
az functionapp create --resource-group disaster-response-rg \
--consumption-plan-location eastus --runtime python --runtime-version 3.11 \
--functions-version 4 --name $FUNCTION_NAME --storage-account $STORAGE_NAME \
--os-type Linux
# 8. Configure app settings
az functionapp config appsettings set --name $FUNCTION_NAME \
--resource-group disaster-response-rg --settings \
COSMOS_ENDPOINT=$COSMOS_ENDPOINT COSMOS_KEY=$COSMOS_KEY \
COSMOS_DATABASE_ID=DisasterResponseDB COSMOS_CONTAINER_ID=Alerts
# 9. Enable CORS
az functionapp cors add --name $FUNCTION_NAME \
--resource-group disaster-response-rg --allowed-origins "*"
# 10. Deploy function
func azure functionapp publish $FUNCTION_NAME
# 11. Test it
echo "Test with: curl -X POST https://${FUNCTION_NAME}.azurewebsites.net/api/SubmitAlert -H 'Content-Type: application/json' -d '{\"location\":\"Test\",\"type\":\"Flood\",\"severity\":\"High\",\"message\":\"Test alert\"}'"# Check if func tools are installed
func --version
# If not, install
npm install -g azure-functions-core-tools@4# Verify credentials are set
az functionapp config appsettings list \
--name $FUNCTION_APP \
--resource-group disaster-response-rg \
--query "[?name=='COSMOS_ENDPOINT' || name=='COSMOS_KEY']"# Re-enable CORS
az functionapp cors remove --name $FUNCTION_APP \
--resource-group disaster-response-rg --allowed-origins "*"
az functionapp cors add --name $FUNCTION_APP \
--resource-group disaster-response-rg --allowed-origins "*"Check Azure Portal logs:
- Go to https://portal.azure.com
- Find your Function App
- Click "Monitor" → "Logs"
- See real-time errors
Good luck with your assignment! 🚀