Access restrictions in Azure App Service work like a network-level firewall that checks each incoming request before it reaches your application. You create a priority-ordered list of rules that either allow or block traffic based on IP addresses, IP ranges, or entire Azure Virtual Network subnets. When you add even one rule, Azure automatically adds an implicit "deny all" at the end, so only traffic you explicitly permit can reach your app. For Windows-based App Services, you can also set up dynamic IP restrictions through the web.config file, which adapts security based on how requests behave.
App Service can handle user authentication before requests ever reach your code, supporting sign-in through Microsoft Entra ID, Microsoft accounts, Facebook, Google, and X. For apps that need to talk to other Azure services, managed identities let your app authenticate under its own identity without storing passwords, while on-behalf-of authentication passes a user's identity through to remote APIs like Microsoft Graph.
Network isolation connects your app to Azure Virtual Networks through VNet Integration, allowing outbound calls to stay within Azure's network. For complete isolation, an App Service Environment (ASE) runs your app in a dedicated virtual network. To reach on-premises systems, Hybrid Connections create a secure TLS 1.2 tunnel that avoids opening inbound firewall ports, or you can combine VNet Integration with a site-to-site VPN. Private Endpoints give your app a private IP address that makes it invisible to the public internet.
Store secrets and certificates in App Service application settings or Azure Key Vault rather than in code. App Service encrypts these values and injects them into your app's memory at runtime. For web traffic security, you can use free managed certificates, App Service certificates, or import certificates from Key Vault, and you should force HTTPS redirects while requiring TLS 1.2 or higher.
Additional protection comes from a Web Application Firewall (WAF) through Azure Application Gateway or Front Door, which blocks common attacks like SQL injection. Azure DDoS Protection guards against large-scale volumetric attacks, and Microsoft Defender for Cloud monitors your security posture while recommending improvements.
Implement VNet Integration
Virtual Network integration lets your App Service send outbound traffic through an Azure virtual network instead of directly to the internet. Regional VNet integration requires your App Service and VNet to share the same region and subscription, and the integration subnet must be delegated to Microsoft.Web/serverFarms. You also need specific RBAC permissions to join subnets to virtual networks.
Application routing controls which outbound traffic flows through your VNet after your app starts running. The vnetRouteAllEnabled setting routes all traffic when enabled, or you can limit it to private RFC1918 addresses only. This toggle appears in the Azure portal under Networking settings, or you can set it through Azure CLI. Azure Policy can audit this routing behavior to ensure your configuration matches security requirements.
Configuration routing handles pre-startup operations like pulling container images, accessing content shares, and performing backups. Each operation has its own setting: vnetImagePullEnabled for container pulls, vnetContentShareEnabled for content access (requiring ports 443 and 445 open in NSGs), and vnetBackupRestoreEnabled for backup and restore operations. Database backups are not supported through this method. These settings ensure your startup tasks follow the same network security rules as your running application.
Network routing applies Network Security Groups (NSGs) and user-defined routes (UDRs) to all traffic flowing through the VNet integration, whether from application or configuration operations. This gives you fine-grained control over how your App Service communicates within Azure while enforcing your security policies consistently.
Manage Private Endpoints and Hybrid Connectivity
Private Endpoints provide inbound access to your App Service using a private IP address from your virtual network. This uses Azure Private Link to keep traffic entirely within Microsoft's network, removing your app from public internet exposure. The endpoint only allows access to the specific resource it's configured for, which prevents data exfiltration. However, standard Access Restrictions do not apply to private endpoint traffic; instead, you manage security through Network Security Groups applied to the integration subnet.
Hybrid Connections handle outbound calls from your App Service to on-premises systems or other networks. Azure Relay creates a secure tunnel over port 443, so you don't need to open inbound firewall ports on your local network. A Hybrid Connection Manager (HCM) installed on your local host bridges the connection between the on-premises resource and Azure, enabling your app to reach internal systems securely.
Virtual Network Integration handles outbound traffic to resources inside Azure virtual networks. Regional VNet Integration connects to networks in the same region, while gateway-required integration serves older cross-region or classic network setups. This capability is essential for reaching back-end services like databases or virtual machines that aren't publicly accessible.
An App Service Environment (ASE) provides the highest level of network isolation by running your apps in a single-tenant, dedicated environment within your virtual network. Unlike the standard multitenant service, an ASE offers complete compute and network isolation with internal load balancing for apps reachable only within your private network, and it supports more instances than standard plans.
Proper DNS configuration is critical when using private endpoints because your app's address must resolve to a private IP rather than a public one. Without correct DNS setup, clients won't be able to reach your app through the private endpoint.