Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a209b4f

Browse files
committedMay 6, 2020
review comments
1 parent d536503 commit a209b4f

File tree

8 files changed

+59
-73
lines changed

8 files changed

+59
-73
lines changed
 

‎articles/container-registry/TOC.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
items:
8585
- name: Restrict access using private endpoint
8686
href: container-registry-private-link.md
87-
- name: Allow access from selected public networks
87+
- name: Configure service firewall rules
8888
href: container-registry-access-selected-networks.md
8989
- name: Restrict access using service endpoint (preview)
9090
href: container-registry-vnet.md
Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
---
2-
title: Configure access from public networks
2+
title: Configure service firewall rules
33
description: Configure IP rules to enable access to an Azure container registry from selected public IP addresses or address ranges.
44
ms.topic: article
55
ms.date: 05/04/2020
66
---
77

8-
# Configure access from selected public networks
8+
# Configure public IP network rules
99

1010
An Azure container registry by default accepts connections over the internet from hosts on any network. This article shows how to configure your container registry to allow access from only specific public IP addresses or address ranges. Equivalent steps using the Azure CLI and Azure portal are provided.
1111

12-
In IP network rules, provide allowed internet address ranges using CIDR notation such as *16.17.18.0/24* or an individual IP addresses like *16.17.18.19*. IP network rules are only allowed for *public* internet IP addresses. IP address ranges reserved for private networks (as defined in RFC 1918) aren't allowed.
12+
IP network rules are configured on the public registry endpoint. IP network rules do not apply to private endpoints configured with [Private Link](container-registry-private-link.md)
1313

14-
Configuring IP access rules is available in the **Premium** container registry service tier. For information about registry service tiers and limits, see [Azure Container Registry SKUs](container-registry-skus.md).
14+
Configuring IP access rules is available in the **Premium** container registry service tier. For information about registry service tiers and limits, see [Azure Container Registry tiers](container-registry-skus.md).
1515

1616
## Access from selected public network - CLI
1717

1818
### Change default network access to registry
1919

20-
By default, an Azure container registry allows connections from hosts on any network. To limit access to a selected network, change the default action to deny access. Substitute the name of your registry in the following [az acr update][az-acr-update] command:
20+
To limit access to a selected public network, first change the default action to deny access. Substitute the name of your registry in the following [az acr update][az-acr-update] command:
2121

2222
```azurecli
2323
az acr update --name myContainerRegistry --default-action Deny
@@ -33,7 +33,8 @@ az acr network-rule add \
3333
--ip-address <public-IP-address>
3434
```
3535

36-
After adding a rule, it takes a few minutes for the rule to take effect.
36+
> [!NOTE]
37+
> After adding a rule, it takes a few minutes for the rule to take effect.
3738
3839
## Access from selected public network - portal
3940

@@ -45,46 +46,35 @@ After adding a rule, it takes a few minutes for the rule to take effect.
4546

4647
![Configure firewall rule for container registry][acr-access-selected-networks]
4748

48-
After adding a rule, it takes a few minutes for the rule to take effect.
49+
> [!NOTE]
50+
> After adding a rule, it takes a few minutes for the rule to take effect.
4951
5052
> [!TIP]
51-
> Optionally, enable registry access from a local client computer or IP address range. To allow this access, you need the computer's public IPv4 address. You can find this address using a search like "what is my IP address" in an Internet browser. The current client IPv4 address also appears automatically when you configure firewall settings on the **Networking** page in the portal.
53+
> Optionally, enable registry access from a local client computer or IP address range. To allow this access, you need the computer's public IPv4 address. You can find this address by searching "what is my IP address" in an internet browser. The current client IPv4 address also appears automatically when you configure firewall settings on the **Networking** page in the portal.
5254
5355
## Disable public network access
5456

55-
In certain scenarios, you might want to disable all public network access to registry. For example, if you set up a [private endpoint](container-registry-private-link.md) for a registry in a virtual network, you might also decide to disable access from outside the virtual network.
56-
57-
### Disable public access - CLI
58-
59-
Substitute the name of your registry in the following [az acr update][az-acr-update] command:
60-
61-
```azurecli
62-
az acr update --name myContainerRegistry --default-action Deny
63-
```
57+
To limit traffic to virtual networks using [Private Link](container-registry-private-link.md), disable the public endpoint on the registry. Disabling the public endpoint overrides all firewall configurations.
6458

6559
### Disable public access - Portal
6660

6761
1. In the portal, navigate to your container registry and select **Settings > Networking**.
6862
1. On the **Public access** tab, in **Allow public access**, select **Disabled**. Then select **Save**.
6963

70-
## Restore default registry access
64+
![Disable public access][acr-access-disabled]
7165

72-
To restore the registry to allow access by default, update the default action. Equivalent steps using the Azure CLI and Azure portal are provided.
73-
74-
### Restore default registry access - CLI
75-
76-
Substitute the name of your registry in the following [az acr update][az-acr-update] command:
66+
## Restore default registry access
7767

78-
```azurecli
79-
az acr update --name myContainerRegistry --default-action Allow
80-
```
68+
To restore the registry to allow access by default, update the default action.
8169

8270
### Restore default registry access - portal
8371

8472
1. In the portal, navigate to your container registry and select **Settings > Networking**.
8573
1. Under **Firewall**, select each address range, and then select the Delete icon.
8674
1. On the **Public access** tab, in **Allow public access**, select **All networks**. Then select **Save**.
8775

76+
![Public access from all networks][acr-access-all-networks]
77+
8878
## Next steps
8979

9080
* To restrict access to a registry using a private endpoint in a virtual network, see [Configure Azure Private Link for an Azure container registry](container-registry-private-link.md).
@@ -101,3 +91,5 @@ az acr update --name myContainerRegistry --default-action Allow
10191
[azure-portal]: https://portal.azure.com
10292

10393
[acr-access-selected-networks]: ./media/container-registry-access-selected-networks/acr-access-selected-networks.png
94+
[acr-access-disabled]: ./media/container-registry-access-selected-networks/acr-access-disabled.png
95+
[acr-access-all-networks]: ./media/container-registry-access-selected-networks/acr-access-all-networks.png

‎articles/container-registry/container-registry-private-link.md

Lines changed: 34 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22
title: Set up private link
33
description: Set up a private endpoint on a container registry and enable access over a private link in a local virtual network
44
ms.topic: article
5-
ms.date: 05/04/2020
5+
ms.date: 05/06/2020
66
---
77

88
# Configure Azure Private Link for an Azure container registry
99

10-
Set up a [private endpoint](../private-link/private-endpoint-overview.md) for your Azure container registry so that clients on an Azure virtual network securely access the registry over a [private link](../private-link/private-link-overview.md). The private endpoint uses a private IP address from the virtual network address space for your registry. Network traffic between the clients on the virtual network and the registry traverses the virtual network and a private link on the Microsoft backbone network, eliminating exposure from the public internet.
10+
Limit access to a registry by assigning virtual network private IP addressess to the registry endpoints using [Azure Private Link](../private-link/private-link-overview.md). Network traffic between the clients on the virtual network and the registry traverses the virtual network and a private link on the Microsoft backbone network, eliminating exposure from the public internet.
1111

1212
You can [configure DNS settings](../private-link/private-endpoint-overview.md#dns-configuration) for your private endpoint, so that the settings resolve to the registry's allocated private IP address. With DNS configuration, clients and services in the network can continue to access the registry at the registry's fully qualified domain name, such as *myregistry.azurecr.io*.
1313

14-
This feature is available in the **Premium** container registry service tier. For information about registry service tiers and limits, see [Azure Container Registry SKUs](container-registry-skus.md).
14+
This feature is available in the **Premium** container registry service tier. For information about registry service tiers and limits, see [Azure Container Registry tiers](container-registry-skus.md).
1515

1616
## Things to know
1717

18-
Currently, image scanning using Azure Security Center isn't available in a registry configured in a virtual network with a private endpoint.
18+
* Currently, image scanning using Azure Security Center isn't available in a registry configured with a private endpoint.
1919

2020
## Prerequisites
2121

2222
* To use the Azure CLI steps in this article, Azure CLI version 2.2.0 or later is recommended. If you need to install or upgrade, see [Install Azure CLI][azure-cli]. Or run in [Azure Cloud Shell](../cloud-shell/quickstart.md).
23-
* If you don't already have a container registry, create one (Premium tier required) and push a sample image such as `hello-world` from Docker Hub. For example, use the [Azure portal][quickstart-portal] or the [Azure CLI][quickstart-cli] to create a registry.
23+
* If you don't already have a container registry, create one (Premium tier required) and [import](container-registry-import-images.md) a sample image such as `hello-world` from Docker Hub. For example, use the [Azure portal][quickstart-portal] or the [Azure CLI][quickstart-cli] to create a registry.
2424
* To configure registry access using a private link in a different Azure subscription, you need to register the resource provider for Azure Container Registry in that subscription. For example:
2525

2626
```azurecli
@@ -32,10 +32,10 @@ Currently, image scanning using Azure Security Center isn't available in a regis
3232
The Azure CLI examples in this article use the following environment variables. Substitute values appropriate for your environment. All examples are formatted for the Bash shell:
3333

3434
```bash
35-
registryName=<container-registry-name>
36-
registryLocation=<container-registry-location> # Azure region such as westeurope where registry created
37-
resourceGroup=<resource-group-name>
38-
vmName=<virtual-machine-name>
35+
REGISTRY_NAME=<container-registry-name>
36+
REGISTRY_LOCATION=<container-registry-location> # Azure region such as westeurope where registry created
37+
RESOURCE_GROUP=<resource-group-name>
38+
VM_NAME=<virtual-machine-name>
3939
```
4040

4141
[!INCLUDE [Set up Docker-enabled VM](../../includes/container-registry-docker-vm-setup.md)]
@@ -50,11 +50,11 @@ When you create a VM, Azure by default creates a virtual network in the same res
5050

5151
```azurecli
5252
networkName=$(az network vnet list \
53-
--resource-group $resourceGroup \
53+
--resource-group $RESOURCE_GROUP \
5454
--query '[].{Name: name}' --output tsv)
5555
5656
subnetName=$(az network vnet list \
57-
--resource-group $resourceGroup \
57+
--resource-group $RESOURCE_GROUP \
5858
--query '[].{Subnet: subnets[0].name}' --output tsv)
5959
6060
echo networkName=$networkName
@@ -69,7 +69,7 @@ echo subnetName=$subnetName
6969
az network vnet subnet update \
7070
--name $subnetName \
7171
--vnet-name $networkName \
72-
--resource-group $resourceGroup \
72+
--resource-group $RESOURCE_GROUP \
7373
--disable-private-endpoint-network-policies
7474
```
7575

@@ -81,7 +81,7 @@ To use a private zone to override the default DNS resolution for your Azure cont
8181

8282
```azurecli
8383
az network private-dns zone create \
84-
--resource-group $resourceGroup \
84+
--resource-group $RESOURCE_GROUP \
8585
--name "privatelink.azurecr.io"
8686
```
8787

@@ -91,7 +91,7 @@ Run [az network private-dns link vnet create][az-network-private-dns-link-vnet-c
9191

9292
```azurecli
9393
az network private-dns link vnet create \
94-
--resource-group $resourceGroup \
94+
--resource-group $RESOURCE_GROUP \
9595
--zone-name "privatelink.azurecr.io" \
9696
--name MyDNSLink \
9797
--virtual-network $networkName \
@@ -103,7 +103,7 @@ az network private-dns link vnet create \
103103
In this section, create the registry's private endpoint in the virtual network. First, get the resource ID of your registry:
104104

105105
```azurecli
106-
registryID=$(az acr show --name $registryName \
106+
registryID=$(az acr show --name $REGISTRY_NAME \
107107
--query 'id' --output tsv)
108108
```
109109

@@ -114,7 +114,7 @@ The following example creates the endpoint *myPrivateEndpoint* and service conne
114114
```azurecli
115115
az network private-endpoint create \
116116
--name myPrivateEndpoint \
117-
--resource-group $resourceGroup \
117+
--resource-group $RESOURCE_GROUP \
118118
--vnet-name $networkName \
119119
--subnet $subnetName \
120120
--private-connection-resource-id $registryID \
@@ -129,7 +129,7 @@ Run [az network private-endpoint show][az-network-private-endpoint-show] to quer
129129
```azurecli
130130
networkInterfaceID=$(az network private-endpoint show \
131131
--name myPrivateEndpoint \
132-
--resource-group $resourceGroup \
132+
--resource-group $RESOURCE_GROUP \
133133
--query 'networkInterfaces[0].id' \
134134
--output tsv)
135135
```
@@ -157,36 +157,40 @@ First run [az network private-dns record-set a create][az-network-private-dns-re
157157

158158
```azurecli
159159
az network private-dns record-set a create \
160-
--name $registryName \
160+
--name $REGISTRY_NAME \
161161
--zone-name privatelink.azurecr.io \
162-
--resource-group $resourceGroup
162+
--resource-group $RESOURCE_GROUP
163163
164164
# Specify registry region in data endpoint name
165165
az network private-dns record-set a create \
166-
--name ${registryName}.${registryLocation}.data \
166+
--name ${REGISTRY_NAME}.${REGISTRY_LOCATION}.data \
167167
--zone-name privatelink.azurecr.io \
168-
--resource-group $resourceGroup
168+
--resource-group $RESOURCE_GROUP
169169
```
170170

171171
Run the [az network private-dns record-set a add-record][az-network-private-dns-record-set-a-add-record] command to create the A records for the registry endpoint and data endpoint:
172172

173173
```azurecli
174174
az network private-dns record-set a add-record \
175-
--record-set-name $registryName \
175+
--record-set-name $REGISTRY_NAME \
176176
--zone-name privatelink.azurecr.io \
177-
--resource-group $resourceGroup \
177+
--resource-group $RESOURCE_GROUP \
178178
--ipv4-address $privateIP
179179
180180
# Specify registry region in data endpoint name
181181
az network private-dns record-set a add-record \
182-
--record-set-name ${registryName}.${registryLocation}.data \
182+
--record-set-name ${REGISTRY_NAME}.${REGISTRY_LOCATION}.data \
183183
--zone-name privatelink.azurecr.io \
184-
--resource-group $resourceGroup \
184+
--resource-group $RESOURCE_GROUP \
185185
--ipv4-address $dataEndpointPrivateIP
186186
```
187187

188188
The private link is now configured and ready for use.
189189

190+
> [!IMPORTANT]
191+
> If you later add a registry [replica](container-registry-geo-replication.md), you currently need to manually add a DNS record for the replica's data endpoint.
192+
193+
190194
## Set up private link - portal
191195

192196
Set up a private link when you create a registry, or add a private link to an existing registry. The following steps assume you already have a virtual network and subnet set up with a VM for testing. You can also [create a new virtual network and subnet](../virtual-network/quick-create-portal.md).
@@ -270,18 +274,7 @@ Your private link is now configured and ready for use.
270274

271275
## Disable public access
272276

273-
For many scenarios, also configure the registry to disable access from public networks. This configuration prevents clients outside the virtual network from reaching the registry endpoints.
274-
275-
### Disable public access - CLI
276-
277-
Substitute the name of your registry in the following [az acr update][az-acr-update] command:
278-
279-
```azurecli
280-
az acr update --name $registryName \
281-
--default-action Deny
282-
```
283-
284-
### Disable public access - Portal
277+
For many scenarios, also configure the registry to disable access from public networks. This configuration prevents clients outside the virtual network from reaching the registry endpoints. To disable public access using the portal:
285278

286279
1. In the portal, navigate to your container registry and select **Settings > Networking**.
287280
1. On the **Public access** tab, in **Allow public access**, select **Disabled**. Then select **Save**.
@@ -295,7 +288,7 @@ To validate the private link connection, SSH to the virtual machine you set up i
295288
Run the `nslookup` command to resolve the IP address of your registry over the private link:
296289

297290
```bash
298-
nslookup $registryName.azurecr.io
291+
nslookup $REGISTRY_NAME.azurecr.io
299292
```
300293

301294
Example output shows the registry's IP address in the address space of the subnet:
@@ -321,7 +314,7 @@ Address: 40.78.103.41
321314
Also verify that you can perform registry operations from the virtual machine in the subnet. Make an SSH connection to your virtual machine, and run [az acr login][az-acr-login] to login to your registry. Depending on your VM configuration, you might need to prefix the following commands with `sudo`.
322315

323316
```bash
324-
az acr login --name $registryName
317+
az acr login --name $REGISTRY_NAME
325318
```
326319

327320
Perform registry operations such as `docker pull` to pull a sample image from the registry. Replace `hello-world:v1` with an image and tag appropriate for your registry, prefixed with the registry login server name (all lowercase):
@@ -340,7 +333,7 @@ For example, to list the private endpoint connections of a registry, run the [az
340333

341334
```azurecli
342335
az acr private-endpoint-connection list \
343-
--registry-name $registryName
336+
--registry-name $REGISTRY_NAME
344337
```
345338

346339
When you set up a private endpoint connection using the steps in this article, the registry automatically accepts connections from clients and services that have RBAC permissions on the registry. You can set up the endpoint to require manual approval of connections. For information about how to approve and reject private endpoint connections, see [Manage a Private Endpoint Connection](../private-link/manage-private-endpoint.md).
@@ -350,7 +343,7 @@ When you set up a private endpoint connection using the steps in this article, t
350343
If you created all the Azure resources in the same resource group and no longer need them, you can optionally delete the resources by using a single [az group delete](/cli/azure/group) command:
351344

352345
```azurecli
353-
az group delete --name $resourceGroup
346+
az group delete --name $RESOURCE_GROUP
354347
```
355348

356349
To clean up your resources in the portal, navigate to your resource group. Once the resource group is loaded, click on **Delete resource group** to remove the resource group and the resources stored there.

‎articles/container-registry/container-registry-vnet.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@ This article shows how to configure a container registry service endpoint (previ
1414
> [!IMPORTANT]
1515
> Azure Container Registry now supports [Azure Private Link](container-registry-private-link.md), enabling private endpoints from a virtual network to be placed on a registry. Private endpoints are accessible from within the virtual network, using private IP addresses. We recommend using private endpoints instead of service endpoints in most network scenarios.
1616
17-
Configuring a registry service endpoint is available in the **Premium** container registry service tier. For information about registry service tiers and limits, see [Azure Container Registry SKUs](container-registry-skus.md).
17+
Configuring a registry service endpoint is available in the **Premium** container registry service tier. For information about registry service tiers and limits, see [Azure Container Registry tiers](container-registry-skus.md).
1818

1919
## Preview limitations
2020

2121
* Future development of service endpoints for Azure Container Registry isn't currently planned. We recommend using [private endpoints](container-registry-private-link.md) instead.
2222
* You can't use the Azure portal to configure service endpoints on a registry.
2323
* Only an [Azure Kubernetes Service](../aks/intro-kubernetes.md) cluster or Azure [virtual machine](../virtual-machines/linux/overview.md) can be used as a host to access a container registry using a service endpoint. *Other Azure services including Azure Container Instances aren't supported.*
24-
* Running [ACR Tasks](container-registry-tasks-overview.md) in a container registry accessed in a virtual network requires a [dedicated agent pool](container-registry-tasks-agent-pools.md).
2524
* Each registry supports a maximum of 100 network access rules.
2625

2726
## Prerequisites

‎includes/container-registry-docker-vm-setup.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@ For test purposes, use a Docker-enabled Ubuntu VM to access an Azure container r
55
You may use the same resource group for your virtual machine and your container registry. This setup simplifies clean-up at the end but isn't required. If you choose to create a separate resource group for the virtual machine and virtual network, run [az group create][az-group-create]. The following example assumes you've set environment variables for the resource group name and registry location:
66

77
```azurecli
8-
az group create --name $resourceGroup --location $registryLocation
8+
az group create --name $RESOURCE_GROUP --location $REGISTRY_LOCATION
99
```
1010

1111
Now deploy a default Ubuntu Azure virtual machine with [az vm create][az-vm-create]. The following example creates a VM named *myDockerVM*.
1212

1313
```azurecli
14+
VM_NAME=myDockerVM
15+
1416
az vm create \
15-
--resource-group $resourceGroup \
16-
--name $vmName \
17+
--resource-group $RESOURCE_GROUP \
18+
--name $VM_NAME \
1719
--image UbuntuLTS \
1820
--admin-username azureuser \
1921
--generate-ssh-keys

0 commit comments

Comments
 (0)
Please sign in to comment.