
Azure Webapp Capture Requests Blocked by Network Rules can be a frustrating issue, especially if you're trying to troubleshoot the problem. Azure Web Apps can be blocked by network rules due to incorrect IP addresses or network configurations.
Incorrect IP addresses in the Azure Web App's network configuration can block incoming requests. This can be caused by a mismatch between the IP address specified in the Azure Web App's configuration and the actual IP address of the Azure Web App.
To resolve this issue, you'll need to update the IP address in the Azure Web App's configuration to match the actual IP address. This can be done by navigating to the Azure Web App's settings and updating the IP address under the "Networking" section.
A different take: Smtp Blocked List Azure
Network Rules Configuration
You can change the unmatched rule action for Azure Web App's Advanced tool site programmatically.
You can run the command `az resource` in the Cloud Shell, or use `Set-AzResource` command, both accepting values of `Allow` or `Deny` for `scmIpSecurityRestrictionsDefaultAction`.
For ARM templates, modify the property `scmIpSecurityRestrictionsDefaultAction` with accepted values of `Allow` or `Deny`.
Set Endpoint-Based Rule
To set an endpoint-based rule, specify the Subscription, Virtual Network, and Subnet drop-down lists, matching what you want to restrict access to.
You can use service endpoints to restrict access to selected Azure virtual network subnets, but they must be already enabled with Microsoft.Web for the subnet that you selected.
If service endpoints aren't already enabled, they're automatically enabled unless you select the Ignore missing Microsoft.Web service endpoints check box.
You can't use service endpoints to restrict access to apps that run in an App Service Environment, where you can control access by applying IP access rules instead.
With service endpoints, you can configure your app with application gateways or other web application firewall (WAF) devices, making it a flexible option for secure back ends.
Check this out: Can Nextjs Be Used on Traditional Web Application
Change Unmatched Rule Action
To change the unmatched rule action for an advanced tool site, you can run a command in the Cloud Shell. The command is az resource, and for more information, visit this page.

You can also use the Set-AzResource command in the Cloud Shell. The accepted values for scmIpSecurityRestrictionsDefaultAction are Allow or Deny.
For ARM templates, modify the property scmIpSecurityRestrictionsDefaultAction to either Allow or Deny. A sample ARM template snippet is provided for reference.
To do this in Bicep, modify the property scmIpSecurityRestrictionsDefaultAction to either Allow or Deny. A sample Bicep snippet is also available for reference.
Access Control
To configure access restrictions for your Azure Web App, you'll need to have the right permissions in place. Specifically, you'll need the Microsoft.Web/sites/config/read permission to get Web App configuration settings.
To update Web App configuration settings, you'll need the Microsoft.Web/sites/config/write permission. This is required to update access restrictions through the Azure portal.
The following permissions are required to configure access restrictions: Microsoft.Web/sites/config/read, Microsoft.Web/sites/config/write, Microsoft.Network/virtualNetworks/subnets/joinViaServiceEndpoint/action, and Microsoft.Web/sites/write.
On a similar theme: Azure Web App Permissions
Permissions
To configure access restrictions, you'll need specific permissions. You'll need the "Microsoft.Web/sites/config/read" permission to get Web App configuration settings.
To update Web App configuration settings, you'll need the "Microsoft.Web/sites/config/write" permission. This permission allows you to make changes to your Web App's settings.
Expand your knowledge: Designing and Implementing Microsoft Azure Networking Solutions Pdf
If you're adding a virtual network (service endpoint) rule, you'll also need the "Microsoft.Network/virtualNetworks/subnets/joinViaServiceEndpoint/action" permission. This permission enables you to join resources like storage accounts or SQL databases to a subnet.
Here are the required permissions:
Note that the "Microsoft.Web/sites/write" permission is only required when updating access restrictions through the Azure portal.
Restrict Access to SCM Site
You can restrict access to the SCM site used by your app. This site is both the web deploy endpoint and the Kudu console.
The SCM site can be assigned access restrictions from the app separately or using the same set of restrictions for both the app and the SCM site.
Selecting the Use main site rules check box will hide the rules list and use the rules from the main site.
Clearing the check box will make your SCM site settings appear again.
This means you can control access to the SCM site independently of the main site, giving you more flexibility in managing who has access to your app's backend.
For more insights, see: Azure Rules Engine
Rule Management
To change the unmatched rule action for an Advanced tool site, you can run a command in the Cloud Shell, specifically using the az resource command or the Set-AzResource command. For the az resource command, accepted values are Allow or Deny.
You can also use the Set-AzResource command, which accepts the same values of Allow or Deny.
To make this change programmatically, you can modify the scmIpSecurityRestrictionsDefaultAction property in your ARM template. Accepted values are Allow or Deny.
A sample ARM template snippet is available to help you with this modification.
For Bicep, you can also modify the scmIpSecurityRestrictionsDefaultAction property, with accepted values of Allow or Deny. A sample Bicep snippet is provided for your reference.
Check this out: How to Change Virtual Network/subnet in Azure Vm
Sources
- https://learn.microsoft.com/en-us/azure/app-service/app-service-ip-restrictions
- https://learn.microsoft.com/en-us/azure/web-application-firewall/ag/web-application-firewall-logs
- https://learn.microsoft.com/en-us/troubleshoot/azure/app-service/troubleshoot-vnet-integration-apps
- https://techcommunity.microsoft.com/blog/azurenetworksecurityblog/demystifying-explicit-proxy-enhancing-security-with-azure-firewall/3873445
- https://techcommunity.microsoft.com/blog/azurenetworksecurityblog/azure-waf-public-preview-javascript-challenge/4188302
Featured Images: pexels.com