Skip to content

Commit 2afcccf

Browse files
author
Jill Grant
authored
Merge pull request #255944 from cachai2/NsgFix
Nsg fix
2 parents af68b5b + 6077b78 commit 2afcccf

3 files changed

Lines changed: 53 additions & 35 deletions

File tree

articles/container-apps/TOC.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@
251251
href: waf-app-gateway.md
252252
- name: Enable User Defined Routes (UDR)
253253
href: user-defined-routes.md
254-
- name: Securing a custom VNET
254+
- name: Securing a custom VNET with an NSG
255255
href: firewall-integration.md
256256
- name: Network proxying
257257
href: network-proxy.md

articles/container-apps/firewall-integration.md

Lines changed: 50 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,57 +16,75 @@ Network Security Groups (NSGs) needed to configure virtual networks closely rese
1616

1717
You can lock down a network via NSGs with more restrictive rules than the default NSG rules to control all inbound and outbound traffic for the Container Apps environment at the subscription level.
1818

19-
In the workload profiles environment, user-defined routes (UDRs) and securing outbound traffic with a firewall are supported. When using an external workload profiles environment, inbound traffic to Container Apps that use external ingress routes through the public IP that exists in the [managed resource group](./networking.md#workload-profiles-environment-1) rather than through your subnet. This means that locking down inbound traffic via NSG or Firewall on an external workload profiles environment is not supported. For more information, see [Networking in Azure Container Apps environments](./networking.md#user-defined-routes-udr).
19+
In the workload profiles environment, user-defined routes (UDRs) and [securing outbound traffic with a firewall](./networking.md#configuring-udr-with-azure-firewall) are supported. When using an external workload profiles environment, inbound traffic to Azure Container Apps is routed through the public IP that exists in the [managed resource group](./networking.md#workload-profiles-environment-1) rather than through your subnet. This means that locking down inbound traffic via NSG or Firewall on an external workload profiles environment isn't supported. For more information, see [Networking in Azure Container Apps environments](./networking.md#user-defined-routes-udr).
2020

2121
In the Consumption only environment, custom user-defined routes (UDRs) and ExpressRoutes aren't supported.
2222

2323
## NSG allow rules
2424

25-
The following tables describe how to configure a collection of NSG allow rules.
26-
>[!NOTE]
27-
> The subnet associated with a Container App Environment on the Consumption only environment requires a CIDR prefix of `/23` or larger. On the workload profiles environment (preview), a `/27` or larger is required.
25+
The following tables describe how to configure a collection of NSG allow rules. The specific rules required depend on your [environment type](./environment.md#types).
2826

2927
### Inbound
3028

31-
| Protocol | Port | ServiceTag | Description |
32-
|--|--|--|--|
33-
| Any | \* | Infrastructure subnet address space | Allow communication between IPs in the infrastructure subnet. This address is passed as a parameter when you create an environment. For example, `10.0.0.0/21`. |
34-
| Any | \* | AzureLoadBalancer | Allow the Azure infrastructure load balancer to communicate with your environment. |
29+
# [Workload profiles environment](#tab/workload-profiles-env)
3530

36-
### Outbound with service tags
31+
>[!Note]
32+
> When using workload profiles, inbound NSG rules only apply for traffic going through your virtual network. If your container apps are set to accept traffic from the public internet, incoming traffic will go through the public endpoint instead of the virtual network.
3733
38-
The following service tags are required when using NSGs on the Consumption only environment:
34+
| Protocol | Source | Source Ports | Destination | Destination Ports | Description |
35+
|--|--|--|--|--|--|
36+
| TCP | Your Client IPs | \* | Your container app's subnet<sup>1</sup> | `443`, `30,000-32,676`<sup>2</sup> | Allow your Client IPs to access Azure Container Apps. |
37+
| TCP | AzureLoadBalancer | \* | Your container app's subnet | `30,000-32,676`<sup>2</sup> | Allow Azure Load Balancer to probe backend pools. |
3938

40-
| Protocol | Port | ServiceTag | Description
41-
|--|--|--|--|
42-
| UDP | `1194` | `AzureCloud.<REGION>` | Required for internal AKS secure connection between underlying nodes and control plane. Replace `<REGION>` with the region where your container app is deployed. |
43-
| TCP | `9000` | `AzureCloud.<REGION>` | Required for internal AKS secure connection between underlying nodes and control plane. Replace `<REGION>` with the region where your container app is deployed. |
44-
| TCP | `443` | `AzureMonitor` | Allows outbound calls to Azure Monitor. |
39+
# [Consumption only environment](#tab/consumption-only-env)
4540

46-
The following service tags are required when using NSGs on the workload profiles environment:
41+
| Protocol | Source | Source Ports | Destination | Destination Ports | Description |
42+
|--|--|--|--|--|--|
43+
| TCP | Your Client IPs | \* | Your container app's subnet<sup>1</sup> | `443` | Allow your Client IPs to access Azure Container Apps. |
44+
| TCP | AzureLoadBalancer | \* | Your container app's subnet | `30,000-32,676`<sup>2</sup> | Allow Azure Load Balancer to probe backend pools. |
45+
46+
---
47+
48+
<sup>1</sup> This address is passed as a parameter when you create an environment. For example, `10.0.0.0/21`.
49+
<sup>2</sup> The full range is required when creating your Azure Container Apps as a port within the range will by dynamically allocated. Once created, the required ports are 2 immutable, static values, and you can update your NSG rules.
4750

48-
>[!Note]
49-
> If you are using Azure Container Registry (ACR) with NSGs configured on your virtual network, create a private endpoint on your ACR to allow Container Apps to pull images through the virtual network.
5051

51-
| Protocol | Port | Service Tag | Description
52-
|--|--|--|--|
53-
| TCP | `443` | `MicrosoftContainerRegistry` | This is the service tag for container registry for microsoft containers. |
54-
| TCP | `443` | `AzureFrontDoor.FirstParty` | This is a dependency of the `MicrosoftContainerRegistry` service tag. |
52+
### Outbound
5553

56-
### Outbound with wild card IP rules
54+
# [Workload profiles environment](#tab/workload-profiles-env)
55+
56+
| Protocol | Source | Source Ports | Destination | Destination Ports | Description |
57+
|--|--|--|--|--|--|
58+
| TCP | Your container app's subnet<sup>1</sup> | \* | Your Container Registry | Your container registry's port | This is required to communicate with your container registry. For example, when using ACR, you need `AzureContainerRegistry` and `AzureActiveDirectory` for the destination, and the port will be your container registry's port unless using private endpoints.<sup>2</sup> |
59+
| TCP | Your container app's subnet | \* | `AzureMonitor` | `443` | Allows outbound calls to Azure Monitor. |
60+
| TCP | Your container app's subnet | \* | `MicrosoftContainerRegistry` | `443` | This is the service tag for Microsoft container registry for system containers. |
61+
| TCP | Your container app's subnet | \* | `AzureFrontDoor.FirstParty` | `443` | This is a dependency of the `MicrosoftContainerRegistry` service tag. |
62+
| UDP | Your container app's subnet | \* | \* | `123` | NTP server. |
63+
| Any | Your container app's subnet | \* | Your container app's subnet | \* | Allow communication between IPs in your container app's subnet. |
64+
| TCP | Your container app's subnet | \* | `AzureActiveDirectory` | `443` | If you're using managed identity, this is required. |
65+
66+
# [Consumption only environment](#tab/consumption-only-env)
67+
68+
| Protocol | Source | Source Ports | Destination | Destination Ports | Description |
69+
|--|--|--|--|--|--|
70+
| TCP | Your container app's subnet<sup>1</sup> | \* | Your Container Registry | Your container registry's port | This is required to communicate with your container registry. For example, when using ACR, you need `AzureContainerRegistry` and `AzureActiveDirectory` for the destination, and the port will be your container registry's port unless using private endpoints.<sup>2</sup> |
71+
| UDP | Your container app's subnet | \* | `AzureCloud.<REGION>` | `1194` | Required for internal AKS secure connection between underlying nodes and control plane. Replace `<REGION>` with the region where your container app is deployed. |
72+
| TCP | Your container app's subnet | \* | `AzureCloud.<REGION>` | `9000` | Required for internal AKS secure connection between underlying nodes and control plane. Replace `<REGION>` with the region where your container app is deployed. |
73+
| TCP | Your container app's subnet | \* | `AzureMonitor` | `443` | Allows outbound calls to Azure Monitor. |
74+
| TCP | Your container app's subnet | \* | `AzureCloud` | `443` | Allowing all outbound on port `443` provides a way to allow all FQDN based outbound dependencies that don't have a static IP. |
75+
| UDP | Your container app's subnet | \* | \* | `123` | NTP server. |
76+
| TCP | Your container app's subnet | \* | \* | `5671` | Container Apps control plane. |
77+
| TCP | Your container app's subnet | \* | \* | `5672` | Container Apps control plane. |
78+
| Any | Your container app's subnet | \* | Your container app's subnet | \* | Allow communication between IPs in your container app's subnet. |
79+
80+
---
5781

58-
The following IP rules are required when using NSGs on both the Consumption only environment and the workload profiles environment:
82+
<sup>1</sup> This address is passed as a parameter when you create an environment. For example, `10.0.0.0/21`.
83+
<sup>2</sup> If you're using Azure Container Registry (ACR) with NSGs configured on your virtual network, create a private endpoint on your ACR to allow Azure Container Apps to pull images through the virtual network. You don't need to add an NSG rule for ACR when configured with private endpoints.
5984

60-
| Protocol | Port | IP | Description |
61-
|--|--|--|--|
62-
| TCP | `443` | \* | Allowing all outbound on port `443` provides a way to allow all FQDN based outbound dependencies that don't have a static IP. |
63-
| UDP | `123` | \* | NTP server. |
64-
| TCP | `5671` | \* | Container Apps control plane. |
65-
| TCP | `5672` | \* | Container Apps control plane. |
66-
| Any | \* | Infrastructure subnet address space | Allow communication between IPs in the infrastructure subnet. This address is passed as a parameter when you create an environment. For example, `10.0.0.0/21`. |
6785

6886
#### Considerations
6987

7088
- If you're running HTTP servers, you might need to add ports `80` and `443`.
71-
- Adding deny rules for some ports and protocols with lower priority than `65000` may cause service interruption and unexpected behavior.
89+
- Adding deny rules for some ports and protocols with lower priority than `65000` might cause service interruption and unexpected behavior.
7290
- Don't explicitly deny the Azure DNS address `168.63.128.16` in the outgoing NSG rules, or your Container Apps environment won't be able to function.

articles/container-apps/user-defined-routes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Azure creates a default route table for your virtual networks on create. By impl
2020

2121
You can also use a NAT gateway or any other third party appliances instead of Azure Firewall.
2222

23-
For more information on networking concepts in Container Apps, see [Networking Environment in Azure Container Apps](./networking.md).
23+
See the [configuring UDR with Azure Firewall](./networking.md#configuring-udr-with-azure-firewall) in [networking in Azure Container Apps](./networking.md) for more information.
2424

2525
## Prerequisites
2626

@@ -66,7 +66,7 @@ A subnet called **AzureFirewallSubnet** is required in order to deploy a firewal
6666
| **Virtual network** | Select the integrated virtual network. |
6767
| **Public IP address** | Select an existing address or create one by selecting **Add new**. |
6868

69-
1. Select **Review + create**. After validation finishes, select **Create**. The validation step may take a few minutes to complete.
69+
1. Select **Review + create**. After validation finishes, select **Create**. The validation step might take a few minutes to complete.
7070

7171
1. Once the deployment completes, select **Go to Resource**.
7272

0 commit comments

Comments
 (0)