π§ What is Azure App Service?¶



Azure App Service is a fully managed PaaS to host:
- Web apps (REST APIs, websites)
- Backend services
- Containers
π You donβt manage servers, OS patches, or runtime installs.
π§± High-Level Architecture¶
User / Client
|
| HTTPS
|
Azure Front Door (optional)
|
Azure App Service
|
App Service Plan (compute)
|
Application Code
|
Logs / Metrics / Monitoring
PART 1οΈβ£ Core Concepts (Very Important)¶
1οΈβ£ App Service vs App Service Plan¶
| Component | Meaning |
|---|---|
| App Service | Your application |
| App Service Plan | Compute (CPU, RAM, scaling) |
π Multiple apps can share one plan.
2οΈβ£ Supported Runtimes¶
- Node.js
- Python
- Java
- .NET
- PHP
- Go (via container)
- Docker containers
PART 2οΈβ£ Create Azure App Service (Portal)¶
STEP 1οΈβ£ Create Resource Group¶
| Field | Value |
|---|---|
| Name | rg-app-demo |
| Region | Central India / East US |
STEP 2οΈβ£ Create App Service¶
Basics Tab¶
| Setting | Value |
|---|---|
| Resource Group | rg-app-demo |
| Name | demo-api-123 |
| Publish | Code |
| Runtime | Node.js 18 / Python 3.11 |
| OS | Linux |
| Region | Same as RG |
STEP 3οΈβ£ Create App Service Plan¶
| Setting | Value |
|---|---|
| Name | asp-demo-linux |
| SKU | B1 (Dev/Test) |
| OS | Linux |
π You pay for App Service Plan, not app count.
STEP 4οΈβ£ Create¶
β³ Takes ~1 minute
PART 3οΈβ£ Deploy an Application¶
OPTION AοΈβ£ Deploy via GitHub (Recommended)¶
1οΈβ£ Connect GitHub Repo¶
β Select repo
β Select branch (main)
β Azure auto-creates GitHub Actions
2οΈβ£ Example Node.js App¶
// index.js
const express = require("express");
const app = express();
app.get("/", (req, res) => {
res.json({ status: "App Service working π" });
});
app.listen(process.env.PORT || 3000);
3οΈβ£ Deployment Flow¶
OPTION BοΈβ£ Deploy via ZIP (CLI)¶
zip -r app.zip .
az webapp deploy \
--resource-group rg-app-demo \
--name demo-api-123 \
--src-path app.zip
PART 4οΈβ£ Configure App Settings (Environment Variables)¶
| Key | Value |
|---|---|
| NODE_ENV | production |
| DB_HOST | private-db |
Access in code:
π No redeploy needed.
PART 5οΈβ£ Logs, Monitoring & Debugging¶
1οΈβ£ Enable Log Streaming¶
β Application logging: ON β Log level: Information
View Logs (CLI)¶
2οΈβ£ Application Insights¶
Tracks:
- Requests
- Errors
- Latency
- Dependencies
PART 6οΈβ£ Scaling (Vertical & Horizontal)¶
Vertical Scaling (Change SKU)¶
| SKU | Use |
|---|---|
| B1 | Dev |
| S1 | Production |
| P1v3 | High traffic |
Horizontal Scaling (Auto-scale)¶
Example rule:
- CPU > 70% β add instance
- CPU < 30% β remove instance
PART 7οΈβ£ Deployment Slots (Zero Downtime)¶
STEP 1οΈβ£ Create Slot¶
| Slot | Purpose |
|---|---|
| staging | Test |
| production | Live |
STEP 2οΈβ£ Deploy to Staging¶
- GitHub Action deploys to
staging
STEP 3οΈβ£ Swap¶
β Zero downtime β Instant rollback
PART 8οΈβ£ Networking & Security (Production-Grade)¶
1οΈβ£ Restrict Public Access¶
Allow:
- Office IP
- VPN
- Azure services only
2οΈβ£ VNet Integration (Outbound)¶
Use when:
- Access private DB
- Call private APIs
3οΈβ£ Private Endpoint (Inbound)¶
β App accessible only via VPN / VNet β No public internet exposure
PART 9οΈβ£ Custom Domain & HTTPS¶
Steps:
- Add DNS record (CNAME / A)
- Bind domain
- Enable HTTPS (free SSL)
PART π Backup & Restore¶
- Schedule daily backups
- Store in Blob Storage
- Restore with 1 click
PART 1οΈβ£1οΈβ£ Validate Everything¶
Check App¶
β Response OK
Check Logs¶
Check Scaling¶
π§ Common Mistakes (Avoid These)¶
| Mistake | Fix |
|---|---|
| Using Free tier for prod | Use S1+ |
| Hardcoding secrets | Use App Settings / Key Vault |
| No health checks | Enable health probe |
| No slots | Always use staging |
| No monitoring | Enable App Insights |
π Final Mental Model¶
App Service Plan = Engine
App Service = Car
Deployment Slot = Gearbox
App Settings = Fuel
Monitoring = Dashboard