Azure App Service

Azure App Service Overview

Azure App Service enables you to create websites, mobile backends, and APIs that run on Windows or Linux. Apps scale easily and support multiple deployment options.

Reasons to Use App Services

  • Multiple languages/frameworks: ASP.NET, Java, Ruby, Node.js, PHP, Python; also PowerShell or scripts as background services.

  • DevOps support: Continuous integration/deployment with Azure DevOps, GitHub, Bitbucket, Docker Hub, or Azure Container Registry. Manage apps via Azure CLI or PowerShell.

  • Global scale & high availability: Scale up/out manually or automatically. SLA ensures high uptime.

  • SaaS & on-prem connectivity: Over 50 connectors for SAP, Salesforce, Facebook; access on-premises via Hybrid Connections and Azure Virtual Networks.

  • Security & compliance: ISO, SOC, PCI compliant. Authenticate via Azure AD or social logins. Supports IP restrictions and managed service identities.

  • Templates & Visual Studio integration: WordPress, Joomla, Drupal templates; integrated debugging/deployment tools.

  • API & mobile features: CORS support, authentication, offline data sync, push notifications.

  • Serverless code: Run code on-demand, pay only for execution time.


Creating an App Service

  1. Resource group and service plan selection.

  2. Configure:

    • Name (unique, e.g., webappces1.azurewebsites.net)

    • Publish: Code or Docker container

    • Runtime stack: .NET Core/Framework, Node.js, PHP, Python, Ruby, etc.

    • Operating system: Windows or Linux

    • Region: Influences App Service plan availability

App Settings

  • Always On: Keeps app loaded for continuous WebJobs.

  • ARR Affinity: Ensures session routing to the same instance (can be disabled for stateless apps).

  • Connection strings: Encrypted in transit and at rest.


Deployment

Continuous Deployment

  • Sources: Azure DevOps, GitHub, Bitbucket, FTP, local Git

  • Supports full CI/CD pipelines, automated build, test, release, and deployment.

Manual Deployment

  • Git, CLI (az webapp up), ZipDeploy, Visual Studio, FTP/S

Deployment Slots

  • Separate staging/production slots for zero-downtime deployments.

  • Advantages: Validate changes, warm-up slots, auto swap.

  • Settings: Some swap (app settings, connection strings), some don’t (IP restrictions, Always On, custom domains).


Security

  • Built-in authentication/authorization: Supports multiple providers, JWT handling, session management.

  • Authorization behaviors: Allow anonymous, allow only authenticated requests.

  • Logging/Tracing: Integrated with app logs; EasyAuthModule traces requests.


Custom Domain Names

  1. Register a domain (via Azure Portal or external registrar).

  2. Create DNS records:

    • A record: Domain → IP address

    • CNAME: Domain → another domain (e.g., contoso.comcontoso.azurewebsites.net)

  3. Validate and enable domain in Azure Portal. Paid tier required.


Backup & Restore

  • Requires Standard/Premium tier

  • Can back up: app configuration, file content, and connected databases (SQL, MySQL, PostgreSQL).

  • Supports full or partial backups, up to 10 GB.

  • Requires Azure Storage account in same subscription.


Monitoring: Application Insights

  • Monitors live apps: request/response rates, failures, exceptions, page views, user sessions.

  • Tracks server metrics (CPU, memory, network) and Docker/Azure diagnostics.

  • Supports custom events/metrics for business logic tracking.

  • Integrates with DevOps tools and mobile telemetry.