Skip to content

Commit a4810b7

Browse files
authored
Merge pull request #99021 from madsd/update-restriction-article
Update access restriction article
2 parents dffbaca + 576fcff commit a4810b7

File tree

2 files changed

+41
-25
lines changed

2 files changed

+41
-25
lines changed

articles/app-service/app-service-ip-restrictions.md

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
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.
44
author: ccompy
55

66
ms.assetid: 3be1f4bd-8a81-4565-8a56-528c037b24bd
@@ -12,19 +12,19 @@ ms.custom: seodec18
1212
---
1313
# Azure App Service Access Restrictions #
1414

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.
1616

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.
1818

1919
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.
2020

2121
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.
2222

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.
2424

2525
![access restrictions flow](media/app-service-ip-restrictions/access-restrictions-flow.png)
2626

27-
## Adding and editing Access Restriction rules in the portal ##
27+
## Adding and editing access restriction rules in the portal ##
2828

2929
To add an access restriction rule to your app, use the menu to open **Network**>**Access Restrictions** and click on **Configure Access Restrictions**
3030

@@ -54,7 +54,7 @@ Service endpoints enables you to restrict access to selected Azure virtual netwo
5454

5555
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.
5656

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).
5858

5959
## Managing access restriction rules
6060

@@ -86,34 +86,50 @@ In addition to being able to control access to your app, you can also restrict a
8686

8787
## Programmatic manipulation of access restriction rules ##
8888

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:
97+
98+
```azurepowershell-interactive
99+
Add-AzWebAppAccessRestrictionRule -ResourceGroupName "ResourceGroup" -WebAppName "AppName"
100+
-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.
90104

91105
The location for this information in Resource Manager is:
92106

93107
management.azure.com/subscriptions/**subscription ID**/resourceGroups/**resource groups**/providers/Microsoft.Web/sites/**web app name**/config/web?api-version=2018-02-01
94108

95109
The JSON syntax for the earlier example is:
96-
97-
{
98-
"properties": {
99-
"ipSecurityRestrictions": [
100-
{
101-
"ipAddress": "122.133.144.0/24",
102-
"action": "Allow",
103-
"tag": "Default",
104-
"priority": 100,
105-
"name": "IP example rule"
106-
}
107-
]
110+
```json
111+
{
112+
"properties": {
113+
"ipSecurityRestrictions": [
114+
{
115+
"ipAddress": "122.133.144.0/24",
116+
"action": "Allow",
117+
"priority": 100,
118+
"name": "IP example rule"
108119
}
109-
}
120+
]
121+
}
122+
}
123+
```
110124

111-
## Function App IP Restrictions
125+
## Azure Function App Access Restrictions
112126

113-
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.
114128

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)
116131

132+
[Application Gateway integration with service endpoints](networking/app-gateway-with-service-endpoints.md)
117133

118134
<!--Links-->
119135
[serviceendpoints]: https://docs.microsoft.com/azure/virtual-network/virtual-network-service-endpoints-overview

articles/app-service/toc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163
href: configure-authentication-provider-twitter.md
164164
- name: Advanced auth
165165
href: app-service-authentication-how-to.md
166-
- name: Restrict IPs
166+
- name: Restrict access
167167
href: app-service-ip-restrictions.md
168168
- name: Use a managed identity
169169
href: overview-managed-identity.md

0 commit comments

Comments
 (0)