Configuring App Services
This section guides you through the essential configuration options for your Microsoft App Services. Proper configuration is key to ensuring optimal performance, security, and scalability of your applications.
1. General Settings
These settings control the fundamental behavior and identity of your App Service.
A unique name for your App Service. This name will be part of its default URL (e.g., your-app-name.azurewebsites.net).
Select the programming language and version for your application (e.g., .NET, Node.js, Python, Java, PHP). Ensure compatibility with your application's dependencies.
Supported Runtimes:
- .NET (Core 3.1, 5.0, 6.0, 7.0)
- Node.js (14.x, 16.x, 18.x)
- Python (3.7, 3.8, 3.9, 3.10)
- Java (8, 11, 17)
- PHP (7.4, 8.0, 8.1)
- Docker Container
Choose between Windows or Linux. Linux is generally recommended for most modern web applications for cost-effectiveness and flexibility.
2. Deployment Slots
Deployment slots allow you to manage multiple deployment environments for your App Service, enabling staged rollouts and easy rollbacks.
Each App Service can have multiple deployment slots. You can configure a staging slot to test new versions of your application before swapping them into the production slot.
- Staging Slot: Use this slot for testing and pre-production validation.
- Production Slot: Your live, publicly accessible application environment.
You can configure auto-swap to automatically deploy changes from a staging slot to production after successful validation.
# Example CLI command to create a deployment slot
az webapp deployment slot create --name <app-name> --resource-group <resource-group-name> --slot staging
3. Networking Configuration
Control how your App Service connects to other services and how it is accessed from the internet.
Configure your own domain names (e.g., www.yourcompany.com) to point to your App Service. This requires DNS configuration and SSL certificate binding.
Secure your custom domain with an SSL/TLS certificate. You can use free App Service Managed Certificates or upload your own.
Connect your App Service to an Azure Virtual Network to allow it to access resources within your private network securely.
Define rules to allow or deny access to your App Service from specific IP addresses or virtual networks.
4. Application Settings
Store application-specific settings, such as connection strings and API keys, as environment variables.
Application settings are injected into your application as environment variables, making it easy to manage configuration without modifying your code.
Store database connection strings, storage account connection strings, and other service connection details here.
<add name="DefaultConnection" connectionString="Server=tcp:yourserver.database.windows.net,1433;Initial Catalog=yourdb;Persist Security Info=False;User ID=youruser;Password=yourpassword;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" providerName="System.Data.SqlClient" />
Any other key-value pairs your application needs (e.g., API_KEY, LOG_LEVEL).
It's highly recommended to use "Deployment slots" for application settings that differ between environments (e.g., production vs. staging) to avoid accidental misconfigurations.
5. Scale Settings
Configure how your App Service scales to handle varying loads.
Manually set the number of instances your App Service runs on. Suitable for predictable workloads.
Configure rules to automatically scale your App Service up or down based on metrics like CPU usage, memory, or HTTP queue length. This ensures performance under fluctuating demand.
Metrics for Auto-scale:
- Average CPU Percentage
- HTTP Queue Length
- Memory Working Set
- Data In/Out
By carefully configuring these settings, you can build robust and scalable applications on Azure App Services.