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
@@ -11,127 +11,77 @@ Setting up a [container group](container-instances-container-groups.md) with an
11
11
12
12
This article provides steps to configure a container group in a [virtual network](container-instances-virtual-network-concepts.md) integrated with [Azure Firewall](../firewall/overview.md). By setting up a user-defined route to the container group and firewall rules, you can route and identify traffic to and from the container group. Container group ingress and egress use the public IP address of the firewall. A single egress IP address can be used by multiple container groups deployed in the virtual network's subnet delegated to Azure Container Instances.
13
13
14
-
In this article you use the Azure CLI to create the resources for this scenario:
14
+
In this article, you use the Azure CLI to create the resources for this scenario:
15
15
16
-
* Container groups deployed on a delegated subnet [in the virtual network](container-instances-vnet.md)
16
+
* Container groups deployed on a delegated subnet [in the virtual network](container-instances-vnet.md)
17
17
* An Azure firewall deployed in the network with a static public IP address
18
18
* A user-defined route on the container groups' subnet
19
19
* A NAT rule for firewall ingress and an application rule for egress
20
20
21
21
You then validate ingress and egress from example container groups through the firewall.
In a typical case, you might already have an Azure virtual network in which to deploy a container group. For demonstration purposes, the following commands create a virtual network and subnet when the container group is created. The subnet is delegated to Azure Container Instances.
The container group runs a small web app from the `aci-helloworld` image. As shown in other articles in the documentation, this image packages a small web app written in Node.js that serves a static HTML page.
**Azure resource group**: If you don't have an Azure resource group already, create a resource group with the [az group create][az-group-create] command. Modify the location value as appropriate.
In a typical case, you might already have an Azure virtual network in which to deploy a container group. For demonstration purposes, the following commands create a virtual network and subnet when the container group is created. The subnet is delegated to Azure Container Instances.
42
+
43
+
The container group runs a small web app from the `aci-helloworld` image. As shown in other articles in the documentation, this image packages a small web app written in Node.js that serves a static HTML page.
40
44
41
45
Create the container group with the [az container create][az-container-create] command:
> Adjust the value of `--subnet address-prefix` for the IP address space you need in your subnet. The smallest supported subnet is /29, which provides eight IP addresses. Some IP addresses are reserved for use by Azure.
56
51
57
52
For use in a later step, get the private IP address of the container group by running the [az container show][az-container-show] command:
58
53
59
-
```azurecli
60
-
ACI_PRIVATE_IP="$(az container show --name appcontainer \
In the following sections, use the Azure CLI to deploy an Azure firewall in the virtual network. For background, see [Tutorial: Deploy and configure Azure Firewall using the Azure portal](../firewall/deploy-cli.md).
68
59
69
60
First, use the [az network vnet subnet create][az-network-vnet-subnet-create] to add a subnet named AzureFirewallSubnet for the firewall. AzureFirewallSubnet is the *required* name of this subnet.
Get the firewall's private IP address using the [az network firewall ip-config list][az-network-firewall-ip-config-list] command. This private IP address is used in a later command.
FW_PRIVATE_IP="$(az network firewall ip-config list \
123
-
--resource-group $RESOURCE_GROUP_NAME \
124
-
--firewall-name myFirewall \
125
-
--query "[].privateIpAddress" --output tsv)"
126
-
```
127
82
Get the firewall's public IP address using the [az network public-ip show][az-network-public-ip-show] command. This public IP address is used in a later command.
@@ -141,85 +91,39 @@ Define a use-defined route on the ACI subnet, to divert traffic to the Azure fir
141
91
142
92
First, run the following [az network route-table create][az-network-route-table-create] command to create the route table. Create the route table in the same region as the virtual network.
Run [az network-route-table route create][az-network-route-table-route-create] to create a route in the route table. To route traffic to the firewall, set the next hop type to `VirtualAppliance`, and pass the firewall's private IP address as the next hop address.
Run the [az network vnet subnet update][az-network-vnet-subnet-update] command to associate the route table with the subnet delegated to Azure Container Instances.
By default, Azure Firewall denies (blocks) inbound and outbound traffic.
110
+
By default, Azure Firewall denies (blocks) inbound and outbound traffic.
182
111
183
112
### Configure NAT rule on firewall to ACI subnet
184
113
185
114
Create a [NAT rule](../firewall/rule-processing.md) on the firewall to translate and filter inbound internet traffic to the application container you started previously in the network. For details, see [Filter inbound Internet traffic with Azure Firewall DNAT](../firewall/tutorial-firewall-dnat.md)
186
115
187
116
Create a NAT rule and collection by using the [az network firewall nat-rule create][az-network-firewall-nat-rule-create] command:
Add NAT rules as needed to filter traffic to other IP addresses in the subnet. For example, other container groups in the subnet could expose IP addresses for inbound traffic, or other internal IP addresses could be assigned to the container group after a restart.
206
121
207
122
### Create outbound application rule on the firewall
208
123
209
124
Run the following [az network firewall application-rule create][az-network-firewall-application-rule-create] command to create an outbound rule on the firewall. This sample rule allows access from the subnet delegated to Azure Container Instances to the FQDN `checkip.dyndns.org`. HTTP access to the site is used in a later step to confirm the egress IP address from Azure Container Instances.
## Test container group access through the firewall
225
129
@@ -229,9 +133,7 @@ The following sections verify that the subnet delegated to Azure Container Insta
229
133
230
134
Test inbound access to the *appcontainer* running in the virtual network by browsing to the firewall's public IP address. Previously, you stored the public IP address in variable $FW_PUBLIC_IP:
@@ -248,16 +150,7 @@ If the NAT rule on the firewall is configured properly, you see the following wh
248
150
249
151
Deploy the following sample container into the virtual network. When it runs, it sends a single HTTP request to `http://checkip.dyndns.org`, which displays the IP address of the sender (the egress IP address). If the application rule on the firewall is configured properly, the firewall's public IP address is returned.
0 commit comments