Skip to content

🧠 What is Azure App Service?

Image

Image

Image

Image

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

Azure Portal β†’ Resource Groups β†’ Create
Field Value
Name rg-app-demo
Region Central India / East US

STEP 2️⃣ Create App Service

Create resource β†’ Web App

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

1️⃣ Connect GitHub Repo

App Service β†’ Deployment Center β†’ GitHub

βœ” 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);
// package.json
{
  "scripts": {
    "start": "node index.js"
  }
}

3️⃣ Deployment Flow

git push
  ↓
GitHub Actions
  ↓
Build
  ↓
Deploy to App Service

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)

App Service β†’ Configuration β†’ Application settings
Key Value
NODE_ENV production
DB_HOST private-db

Access in code:

process.env.DB_HOST

πŸ‘‰ No redeploy needed.


PART 5️⃣ Logs, Monitoring & Debugging

1️⃣ Enable Log Streaming

App Service β†’ Logs

βœ” Application logging: ON βœ” Log level: Information


View Logs (CLI)

az webapp log tail \
  --resource-group rg-app-demo \
  --name demo-api-123

2️⃣ Application Insights

App Service β†’ Application Insights β†’ Enable

Tracks:

  • Requests
  • Errors
  • Latency
  • Dependencies

PART 6️⃣ Scaling (Vertical & Horizontal)

Vertical Scaling (Change SKU)

App Service Plan β†’ Scale up
SKU Use
B1 Dev
S1 Production
P1v3 High traffic

Horizontal Scaling (Auto-scale)

App Service Plan β†’ Scale out

Example rule:

  • CPU > 70% β†’ add instance
  • CPU < 30% β†’ remove instance

PART 7️⃣ Deployment Slots (Zero Downtime)

STEP 1️⃣ Create Slot

App Service β†’ Deployment slots β†’ Add
Slot Purpose
staging Test
production Live

STEP 2️⃣ Deploy to Staging

  • GitHub Action deploys to staging

STEP 3️⃣ Swap

Slots β†’ Swap

βœ” Zero downtime βœ” Instant rollback


PART 8️⃣ Networking & Security (Production-Grade)

1️⃣ Restrict Public Access

Networking β†’ Access restrictions

Allow:

  • Office IP
  • VPN
  • Azure services only

2️⃣ VNet Integration (Outbound)

Networking β†’ VNet integration

Use when:

  • Access private DB
  • Call private APIs

3️⃣ Private Endpoint (Inbound)

Networking β†’ Private Endpoint

βœ” App accessible only via VPN / VNet βœ” No public internet exposure


PART 9️⃣ Custom Domain & HTTPS

Custom domains β†’ Add

Steps:

  1. Add DNS record (CNAME / A)
  2. Bind domain
  3. Enable HTTPS (free SSL)

PART πŸ”Ÿ Backup & Restore

App Service β†’ Backups
  • Schedule daily backups
  • Store in Blob Storage
  • Restore with 1 click

PART 1️⃣1️⃣ Validate Everything

Check App

curl https://demo-api-123.azurewebsites.net

βœ” Response OK


Check Logs

az webapp log tail ...

Check Scaling

Metrics β†’ CPU / Memory

🧠 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