You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/app-service/app-service-ip-restrictions.md
+40-24Lines changed: 40 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
-
title: Restrict access for IP addresses
3
-
description: Learn how to secure your app in Azure App Service by explicitly whitelisting client IP addresses or address ranges.
2
+
title: Azure App Service access restrictions
3
+
description: Learn how to secure your app in Azure App Service by specifying access restrictions.
4
4
author: ccompy
5
5
6
6
ms.assetid: 3be1f4bd-8a81-4565-8a56-528c037b24bd
@@ -12,19 +12,19 @@ ms.custom: seodec18
12
12
---
13
13
# Azure App Service Access Restrictions #
14
14
15
-
Access Restrictions enable you to define a priority ordered allow/deny list that controls network access to your app. The list can include IP addresses or Azure Virtual Network subnets. When there are one or more entries, there is then an implicit "deny all" that exists at the end of the list.
15
+
Access restrictions enable you to define a priority ordered allow/deny list that controls network access to your app. The list can include IP addresses or Azure Virtual Network subnets. When there are one or more entries, there is then an implicit "deny all" that exists at the end of the list.
16
16
17
-
The Access Restrictions capability works with all App Service hosted work loads including; web apps, API apps, Linux apps, Linux container apps, and Functions.
17
+
The access restrictions capability works with all App Service hosted work loads including; web apps, API apps, Linux apps, Linux container apps, and Functions.
18
18
19
19
When a request is made to your app, the FROM address is evaluated against the IP address rules in your access restrictions list. If the FROM address is in a subnet that is configured with service endpoints to Microsoft.Web, then the source subnet is compared against the virtual network rules in your access restrictions list. If the address is not allowed access based on the rules in the list, the service replies with an [HTTP 403](https://en.wikipedia.org/wiki/HTTP_403) status code.
20
20
21
21
The access restrictions capability is implemented in the App Service front-end roles, which are upstream of the worker hosts where your code runs. Therefore, access restrictions are effectively network ACLs.
22
22
23
-
The ability to restrict access to your web app from an Azure Virtual Network (VNet) is called [service endpoints][serviceendpoints]. Service endpoints enable you to restrict access to a multi-tenant service from selected subnets. It must be enabled on both the networking side as well as the service that it is being enabled with. It does not work to restrict traffic to apps that are hosted in an App Service Environment. If you are in an App Service Environment, you can control access to your app with IP address rules.
23
+
The ability to restrict access to your web app from an Azure Virtual Network (VNet) is called [service endpoints][serviceendpoints]. Service endpoints enable you to restrict access to a multi-tenant service from selected subnets. It must be enabled on both the networking side as well as the service that it is being enabled with. It does not work to restrict traffic to apps that are hosted in an App Service Environment. If you are in an App Service Environment, you can control access to your app with IP address rules.
## Adding and editing Access Restriction rules in the portal ##
27
+
## Adding and editing access restriction rules in the portal ##
28
28
29
29
To add an access restriction rule to your app, use the menu to open **Network**>**Access Restrictions** and click on **Configure Access Restrictions**
30
30
@@ -54,7 +54,7 @@ Service endpoints enables you to restrict access to selected Azure virtual netwo
54
54
55
55
Service endpoints cannot be used to restrict access to apps that run in an App Service Environment. When your app is in an App Service Environment, you can control access to your app with IP access rules.
56
56
57
-
With service endpoints, you can configure your app with Application Gateways or other WAF devices. You can also configure multi-tier applications with secure backends. For more details on some of the possibilities, read [Networking features and App Service](networking-features.md).
57
+
With service endpoints, you can configure your app with Application Gateways or other WAF devices. You can also configure multi-tier applications with secure backends. For more details on some of the possibilities, read [Networking features and App Service](networking-features.md) and [Application Gateway integration with service endpoints](networking/app-gateway-with-service-endpoints.md).
58
58
59
59
## Managing access restriction rules
60
60
@@ -86,34 +86,50 @@ In addition to being able to control access to your app, you can also restrict a
86
86
87
87
## Programmatic manipulation of access restriction rules ##
88
88
89
-
There currently is no CLI or PowerShell for the new Access Restrictions capability but the values can be set manually with an [Azure REST API](https://docs.microsoft.com/rest/api/azure/) PUT operation on the app configuration in Resource Manager. As an example, you can use resources.azure.com and edit the ipSecurityRestrictions block to add the required JSON.
89
+
[Azure CLI](https://docs.microsoft.com/cli/azure/webapp/config/access-restriction?view=azure-cli-latest) and [Azure PowerShell](https://docs.microsoft.com/powershell/module/Az.Websites/Add-AzWebAppAccessRestrictionRule?view=azps-3.1.0) has support for editing access restrictions.
90
+
Example of adding an access restriction using Azure CLI:
91
+
92
+
```azurecli-interactive
93
+
az webapp config access-restriction add --resource-group ResourceGroup --name AppName \
94
+
--rule-name 'IP example rule' --action Allow --ip-address 122.133.144.0/24 --priority 100
95
+
```
96
+
Example of adding an access restriction using Azure PowerShell:
-Name "Ip example rule" -Priority 100 -Action Allow -IpAddress 122.133.144.0/24
101
+
```
102
+
103
+
Values can also be set manually with an [Azure REST API](https://docs.microsoft.com/rest/api/azure/) PUT operation on the app configuration in Resource Manager or using an Azure Resource Manager template. As an example, you can use resources.azure.com and edit the ipSecurityRestrictions block to add the required JSON.
90
104
91
105
The location for this information in Resource Manager is:
IP restrictions are available for both Function Apps with the same functionality as App Service plans. Enabling IP restrictions will disable the portal code editor for any disallowed IPs.
127
+
Access restrictions are available for both Function Apps with the same functionality as App Service plans. Enabling access restrictions will disable the portal code editor for any disallowed IPs.
114
128
115
-
[Learn more here](../azure-functions/functions-networking-options.md#inbound-ip-restrictions)
129
+
## Next steps
130
+
[Access restrictions for Azure Function Apps](../azure-functions/functions-networking-options.md#inbound-ip-restrictions)
116
131
132
+
[Application Gateway integration with service endpoints](networking/app-gateway-with-service-endpoints.md)
0 commit comments