App Services Reference
This document provides detailed reference information for Azure App Services, covering its core components, configuration options, deployment strategies, and operational aspects.
App Service Plan
An App Service plan defines a set of compute resources for your web apps, API apps, and mobile apps to run. When you choose an App Service plan, you choose a region, the size of the virtual machines (SKUs), and the number of instances.
- SKUs: F1 (Free), D1 (Shared), B1, B2, B3 (Basic), S1, S2, S3 (Standard), P1v2, P2v2, P3v2 (Premium v2), P1v3, P2v3, P3v3 (Premium v3), I1v2, I2v2, I3v2 (Isolated v2).
- Features by Tier: Different tiers offer varying levels of CPU, RAM, storage, custom domains, SSL, autoscaling, and deployment slots.
- Scaling: Both manual and automatic scaling are supported based on metrics like CPU usage, memory, or HTTP queue length.
Web App
Web Apps are Azure's Platform-as-a-Service (PaaS) offering for hosting web applications, REST APIs, and mobile backends.
- Supported Runtimes: .NET, .NET Core, Java, Node.js, PHP, Python, Ruby, and custom containers.
- Deployment Methods: Git, FTP, Cloud Sync, Web Deploy, CI/CD pipelines (Azure DevOps, GitHub Actions), Docker Hub, Azure Container Registry.
API App
API Apps are designed specifically for hosting RESTful APIs. They offer features like built-in support for Swagger/OpenAPI, authentication, and hybrid connection capabilities.
Logic App
While not directly hosted within App Services in the same way as Web/API Apps, Logic Apps are often integrated with App Services to orchestrate business processes and workflows.
Deployment Methods
Azure App Services supports a wide range of deployment methods to suit different workflows:
- Local Git Repository: Push code directly from your local machine.
- External Git Repository: Connect to GitHub, Bitbucket, or Azure Repos for continuous deployment.
- FTP/FTPS: Deploy files using FTP clients.
- Zip Deploy: Deploy a zip archive of your application.
- Web Deploy: A robust deployment tool for .NET applications.
- CI/CD Pipelines: Integrate with Azure DevOps, GitHub Actions, Jenkins, and other CI/CD tools for automated builds and deployments.
- Container Registries: Deploy applications from Docker Hub, Azure Container Registry, or other private registries.
Continuous Integration
Automate your build and deployment process. Configure App Services to automatically deploy new code whenever changes are pushed to your connected Git repository or build pipeline.
Deployment Slots
Deployment slots allow you to deploy different versions of your application to separate environments. You can then swap these slots to perform blue-green deployments, staging, or rollback operations with zero downtime.
- Staging Slot: Deploy and test new versions in a staging slot.
- Swapping: Easily swap the staging slot with the production slot.
- Auto-swap: Configure automatic swapping upon successful deployment to a staging slot.
App Settings
App settings are environment variables that your application can read at runtime. These are useful for storing configuration values like API keys, database endpoints, and feature flags. They are scoped per App Service instance.
# Example of reading an app setting in Node.js
const apiKey = process.env.MY_API_KEY;
Connection Strings
Connection strings store the information needed to connect to external data sources, such as databases. They are also scoped per App Service instance and are masked in the Azure portal for security.
# Example of reading a connection string in Python (using a hypothetical library)
import os
db_connection_string = os.environ.get('DATABASE_URL')
Custom Domains
Map your own domain names (e.g., www.yourcompany.com) to your App Service. This involves configuring DNS records with your domain registrar.
- CNAME Records: Point your subdomain to the App Service's default hostname.
- A Records: Point your apex domain directly to the App Service's IP address.
SSL/TLS Bindings
Secure your custom domain with an SSL/TLS certificate. App Services supports uploading your own certificates or purchasing certificates directly from Azure.
- Managed Certificates: Free, auto-renewing certificates provided by Azure for custom domains on Standard tier and above.
- App Service Certificates: Purchase and manage SSL certificates through Azure.
- Import Certificates: Upload PFX files for existing certificates.
Application Insights
Application Insights is an extensible Application Performance Management (APM) service for developers. Use it to monitor your live web application, detect anomalies, diagnose issues, and understand how users interact with your app.
- Live Metrics: Real-time performance monitoring.
- Availability Tests: Monitor your application's uptime from global locations.
- Performance Analysis: Identify performance bottlenecks.
- Usage Analytics: Track user behavior and feature usage.
Diagnostic Logs
Configure diagnostic settings to send logs (application logs, web server logs, deployment logs, etc.) to various destinations, including Log Analytics, Azure Storage, or Event Hubs, for long-term storage and analysis.
Monitoring Metrics
Azure App Services provides a rich set of metrics that can be used for monitoring performance and health. These include requests, response times, CPU percentage, memory percentage, data in/out, and more.
Virtual Network Integration
Connect your App Service to an Azure Virtual Network (VNet) to access resources within your private network securely. This is crucial for applications that need to interact with databases, storage accounts, or other services within a VNet.
Private Endpoints
Use private endpoints to securely access your App Service from within your virtual network without exposing it to the public internet. This enhances security by keeping traffic within the Azure backbone network.