Skip to content

Commit ad4d271

Browse files
committed
variable names; geo-replication
1 parent b03556e commit ad4d271

File tree

1 file changed

+32
-27
lines changed

1 file changed

+32
-27
lines changed

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

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
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/06/2020
5+
ms.date: 05/07/2020
66
---
77

88
# 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
4949
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:
5050

5151
```azurecli
52-
networkName=$(az network vnet list \
52+
NETWORK_NAME=$(az network vnet list \
5353
--resource-group $RESOURCE_GROUP \
5454
--query '[].{Name: name}' --output tsv)
5555
56-
subnetName=$(az network vnet list \
56+
SUBNET_NAME=$(az network vnet list \
5757
--resource-group $RESOURCE_GROUP \
5858
--query '[].{Subnet: subnets[0].name}' --output tsv)
5959
60-
echo networkName=$networkName
61-
echo subnetName=$subnetName
60+
echo NETWORK_NAME=$NETWORK_NAME
61+
echo SUBNET_NAME=$SUBNET_NAME
6262
```
6363

6464
### Disable network policies in subnet
@@ -67,8 +67,8 @@ echo subnetName=$subnetName
6767

6868
```azurecli
6969
az network vnet subnet update \
70-
--name $subnetName \
71-
--vnet-name $networkName \
70+
--name $SUBNET_NAME \
71+
--vnet-name $NETWORK_NAME \
7272
--resource-group $RESOURCE_GROUP \
7373
--disable-private-endpoint-network-policies
7474
```
@@ -94,7 +94,7 @@ az network private-dns link vnet create \
9494
--resource-group $RESOURCE_GROUP \
9595
--zone-name "privatelink.azurecr.io" \
9696
--name MyDNSLink \
97-
--virtual-network $networkName \
97+
--virtual-network $NETWORK_NAME \
9898
--registration-enabled false
9999
```
100100

@@ -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 $REGISTRY_NAME \
106+
REGISTRY_ID=$(az acr show --name $REGISTRY_NAME \
107107
--query 'id' --output tsv)
108108
```
109109

@@ -115,9 +115,9 @@ The following example creates the endpoint *myPrivateEndpoint* and service conne
115115
az network private-endpoint create \
116116
--name myPrivateEndpoint \
117117
--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 \
121121
--group-ids registry \
122122
--connection-name myConnection
123123
```
@@ -127,32 +127,39 @@ az network private-endpoint create \
127127
Run [az network private-endpoint show][az-network-private-endpoint-show] to query the endpoint for the network interface ID:
128128

129129
```azurecli
130-
networkInterfaceID=$(az network private-endpoint show \
130+
NETWORK_INTERFACE_ID=$(az network private-endpoint show \
131131
--name myPrivateEndpoint \
132132
--resource-group $RESOURCE_GROUP \
133133
--query 'networkInterfaces[0].id' \
134134
--output tsv)
135135
```
136136

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:
138138

139139
```azurecli
140-
privateIP=$(az resource show \
141-
--ids $networkInterfaceID \
142-
--api-version 2019-04-01 --query 'properties.ipConfigurations[1].properties.privateIPAddress' \
140+
PRIVATE_IP=$(az resource show \
141+
--ids $NETWORK_INTERFACE_ID \
142+
--api-version 2019-04-01 \
143+
--query 'properties.ipConfigurations[1].properties.privateIPAddress' \
143144
--output tsv)
144145
145-
dataEndpointPrivateIP=$(az resource show \
146-
--ids $networkInterfaceID \
146+
DATA_ENDPOINT_PRIVATE_IP=$(az resource show \
147+
--ids $NETWORK_INTERFACE_ID \
147148
--api-version 2019-04-01 \
148149
--query 'properties.ipConfigurations[0].properties.privateIPAddress' \
149150
--output tsv)
150151
```
151152

153+
> [!NOTE]
154+
> If your registry is [geo-replicated](container-registry-geo-replication.md), query for the additional data endpoint for each registry replica.
155+
152156
### Create DNS records in the private zone
153157

154158
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`.
155159

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+
156163
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:
157164

158165
```azurecli
@@ -175,22 +182,18 @@ az network private-dns record-set a add-record \
175182
--record-set-name $REGISTRY_NAME \
176183
--zone-name privatelink.azurecr.io \
177184
--resource-group $RESOURCE_GROUP \
178-
--ipv4-address $privateIP
185+
--ipv4-address $PRIVATE_IP
179186
180187
# Specify registry region in data endpoint name
181188
az network private-dns record-set a add-record \
182189
--record-set-name ${REGISTRY_NAME}.${REGISTRY_LOCATION}.data \
183190
--zone-name privatelink.azurecr.io \
184191
--resource-group $RESOURCE_GROUP \
185-
--ipv4-address $dataEndpointPrivateIP
192+
--ipv4-address $DATA_ENDPOINT_PRIVATE_IP
186193
```
187194

188195
The private link is now configured and ready for use.
189196

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-
194197
## Set up private link - portal
195198

196199
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.
274277

275278
## Disable public access
276279

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:
278281

279282
1. In the portal, navigate to your container registry and select **Settings > Networking**.
280283
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
340343

341344
## Add zone records for replicas
342345

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

345350
## Clean up resources
346351

0 commit comments

Comments
 (0)