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/container-registry/container-registry-private-link.md
+32-27Lines changed: 32 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Set up private link
3
3
description: Set up a private endpoint on a container registry and enable access over a private link in a local virtual network
4
4
ms.topic: article
5
-
ms.date: 05/06/2020
5
+
ms.date: 05/07/2020
6
6
---
7
7
8
8
# Configure Azure Private Link for an Azure container registry
@@ -49,16 +49,16 @@ If you don't have them already, you'll need the names of a virtual network and s
49
49
When you create a VM, Azure by default creates a virtual network in the same resource group. The name of the virtual network is based on the name of the virtual machine. For example, if you name your virtual machine *myDockerVM*, the default virtual network name is *myDockerVMVNET*, with a subnet named *myDockerVMSubnet*. Set these values in environment variables by running the [az network vnet list][az-network-vnet-list] command:
@@ -94,7 +94,7 @@ az network private-dns link vnet create \
94
94
--resource-group $RESOURCE_GROUP \
95
95
--zone-name "privatelink.azurecr.io" \
96
96
--name MyDNSLink \
97
-
--virtual-network $networkName \
97
+
--virtual-network $NETWORK_NAME \
98
98
--registration-enabled false
99
99
```
100
100
@@ -103,7 +103,7 @@ az network private-dns link vnet create \
103
103
In this section, create the registry's private endpoint in the virtual network. First, get the resource ID of your registry:
104
104
105
105
```azurecli
106
-
registryID=$(az acr show --name $REGISTRY_NAME \
106
+
REGISTRY_ID=$(az acr show --name $REGISTRY_NAME \
107
107
--query 'id' --output tsv)
108
108
```
109
109
@@ -115,9 +115,9 @@ The following example creates the endpoint *myPrivateEndpoint* and service conne
115
115
az network private-endpoint create \
116
116
--name myPrivateEndpoint \
117
117
--resource-group $RESOURCE_GROUP \
118
-
--vnet-name $networkName \
119
-
--subnet $subnetName \
120
-
--private-connection-resource-id $registryID \
118
+
--vnet-name $NETWORK_NAME \
119
+
--subnet $SUBNET_NAME \
120
+
--private-connection-resource-id $REGISTRY_ID \
121
121
--group-ids registry \
122
122
--connection-name myConnection
123
123
```
@@ -127,32 +127,39 @@ az network private-endpoint create \
127
127
Run [az network private-endpoint show][az-network-private-endpoint-show] to query the endpoint for the network interface ID:
128
128
129
129
```azurecli
130
-
networkInterfaceID=$(az network private-endpoint show \
130
+
NETWORK_INTERFACE_ID=$(az network private-endpoint show \
131
131
--name myPrivateEndpoint \
132
132
--resource-group $RESOURCE_GROUP \
133
133
--query 'networkInterfaces[0].id' \
134
134
--output tsv)
135
135
```
136
136
137
-
Associated with the network interface are two private IP addresses for the container registry: one for the registry itself, and one for the registry's data endpoint. Run the following [az resource show][az-resource-show] commands to get the private IP addresses for the container registry and the registry's data endpoint:
137
+
Associated with the network interface in this example are two private IP addresses for the container registry: one for the registry itself, and one for the registry's data endpoint. The following [az resource show][az-resource-show] commands get the private IP addresses for the container registry and the registry's data endpoint:
> If your registry is [geo-replicated](container-registry-geo-replication.md), query for the additional data endpoint for each registry replica.
155
+
152
156
### Create DNS records in the private zone
153
157
154
158
The following commands create DNS records in the private zone for the registry endpoint and its data endpoint. For example, if you have a registry named *myregistry* in the *westeurope* region, the endpoint names are `myregistry.azurecr.io` and `myregistry.westeurope.data.azurecr.io`.
155
159
160
+
> [!NOTE]
161
+
> If your registry is [geo-replicated](container-registry-geo-replication.md), create additonal DNS records for each replica's data endpoint IP.
162
+
156
163
First run [az network private-dns record-set a create][az-network-private-dns-record-set-a-create] to create empty A record sets for the registry endpoint and data endpoint:
157
164
158
165
```azurecli
@@ -175,22 +182,18 @@ az network private-dns record-set a add-record \
The private link is now configured and ready for use.
189
196
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
-
194
197
## Set up private link - portal
195
198
196
199
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).
@@ -274,7 +277,7 @@ Your private link is now configured and ready for use.
274
277
275
278
## Disable public access
276
279
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:
280
+
For many scenarios, disable registry access from public networks. This configuration prevents clients outside the virtual network from reaching the registry endpoints. To disable public access using the portal:
278
281
279
282
1. In the portal, navigate to your container registry and select **Settings > Networking**.
280
283
1. On the **Public access** tab, in **Allow public access**, select **Disabled**. Then select **Save**.
@@ -340,7 +343,9 @@ When you set up a private endpoint connection using the steps in this article, t
340
343
341
344
## Add zone records for replicas
342
345
343
-
As shown in this article, when you add a private endpoint connection to a registry, DNS records in the `privatelink.azurecr.io` zone are created for the registry and its data endpoints in all regions where the registry is [replicated](container-registry-geo-replication.md). If you later add a new replica, you need to manually add a new zone record for the data endpoint in that region. For example, if you create a replica of *myregistry* in the *northeurope* location, add a zone record for `myregistry.northeurope.data.azurecr.io`. For steps, see [Create DNS records in the private zone](#create-dns-records-in-the-private-zone) in this article.
346
+
As shown in this article, when you add a private endpoint connection to a registry, DNS records in the `privatelink.azurecr.io` zone are created for the registry and its data endpoints in the regions where the registry is [replicated](container-registry-geo-replication.md).
347
+
348
+
If you later add a new replica, you need to manually add a new zone record for the data endpoint in that region. For example, if you create a replica of *myregistry* in the *northeurope* location, add a zone record for `myregistry.northeurope.data.azurecr.io`. For steps, see [Create DNS records in the private zone](#create-dns-records-in-the-private-zone) in this article.
0 commit comments