Skip to content
Back to Cloud Services

Azure App Service

Fully managed PaaS for hosting web applications and REST APIs with autoscaling, deployment slots, and built-in CI/CD.

AzureIntermediate

Why

App Service removes OS patching, load balancer setup, and TLS certificate management so teams ship web apps faster. It supports .NET, Node.js, Python, Java, and PHP runtimes out of the box and integrates with Azure Monitor, Key Vault, and AD for enterprise-grade security.

When

Choose App Service for line-of-business web apps, internal portals, and REST APIs that need PaaS simplicity. Prefer it over VMs when you do not want to manage the OS, and over Functions when you have long-running or always-on workloads with predictable traffic.

How

1. Create an App Service Plan (defines pricing tier, region, OS). 2. Create the App Service on the plan and pick a runtime stack. 3. Configure deployment source: Azure DevOps, GitHub Actions, or local Git. 4. Set app settings (connection strings, secrets via Key Vault references). 5. Enable deployment slots (staging) for zero-downtime swaps. 6. Configure autoscale rules on the plan. 7. Deploy code and verify at https://<app-name>.azurewebsites.net. ```bash az appservice plan create --name myPlan --resource-group rg --sku B1 --is-linux az webapp create --name myapp --plan myPlan --resource-group rg --runtime "NODE:18-lts" az webapp config appsettings set --name myapp --resource-group rg --settings DB_URL="\${DB_URL}" ```

Example

GitHub Actions workflow deploying a Node.js app to a staging slot then swapping to production: ```yaml # .github/workflows/deploy.yml on: { push: { branches: [main] } } jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: azure/login@v1 with: { creds: ${{ secrets.AZURE_CREDS }} } - uses: azure/webapps-deploy@v3 with: app-name: myapp slot-name: staging package: . - run: az webapp deployment slot swap --name myapp --slot staging --resource-group rg ```

Common Problems

  • ⚠App starts locally but fails on Azure with 'module not found' — usually Node.js version mismatch between local and the runtime set via --runtime.
  • ⚠Cold start on Free/F1 tier after 20 minutes idle; upgrade to B1 or enable Always On to keep the app warm.
  • ⚠Deployment slot swap fails because app settings are not slot-sticky (marked as 'deployment slot setting'), causing connection strings to point to the wrong database.

Best Practices

  • ✓Use Key Vault references in app settings (@Microsoft.KeyVault(...)) instead of pasting secrets directly, so secrets rotate without redeploying.
  • ✓Keep connection strings and API keys slot-sticky so a swap does not accidentally point production at the staging database.
  • ✓Enable Application Insights from day one to get request tracing, dependency maps, and failure analytics for free.

FAQ

What is Azure App Service and what problem does it solve?

Fully managed PaaS for hosting web applications and REST APIs with autoscaling, deployment slots, and built-in CI/CD. It lets developers deploy, store, and scale without self-managing infrastructure — a core reference for cloud service selection.

How do I get started with Azure App Service in 5 minutes?

Two steps to run it: (1) Create an App Service Plan (defines pricing tier, region, OS).; (2) Create the App Service on the plan and pick a runtime stack.. Validate on the free tier first, then wire into production.

What is the #1 pitfall with Azure App Service?

The most frequent issue is: App starts locally but fails on Azure with 'module not found' — usually Node.js version mismatch between local and the runtime set via --runtime.. Run a pre-launch checklist item by item, and add policy/config scanning in CI.

What are the best practices for Azure App Service?

Best practices for Azure App Service include: Use Key Vault references in app settings (@Microsoft.KeyVault(...)) instead of pasting secrets directly, so secrets rotate without redeploying.; Keep connection strings and API keys slot-sticky so a swap does not accidentally point production at the staging database.; Enable Application Insights from day one to get request tracing, dependency maps, and failure analytics for free.. The first one — "Use Key Vault references in app settings (@Microsoft.KeyVault(...)) instead of pasting secrets directly, so secrets rotate without redeploying." — should be a team default baked into your IaC templates.

How do I control cost and avoid bill surprises with Azure App Service?

Three ways to prevent overspend: (1) tag every resource with env/team and enable billing alarms; (2) set budget thresholds to trigger Slack/email alerts; (3) review idle resources in Cost Explorer regularly and clean them up. Most Azure App Service options offer a free tier — validate within free quota before scaling.