Skip to content

Commit 5b1257f

Browse files
committed
Freshness pass updates
1 parent 4ae52f6 commit 5b1257f

File tree

1 file changed

+56
-29
lines changed

1 file changed

+56
-29
lines changed

articles/aks/cluster-container-registry-integration.md

Lines changed: 56 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ You can set up the AKS to ACR integration in a few steps using the Azure CLI, Az
2626

2727
## Create a new AKS cluster with ACR integration
2828

29-
You can set up AKS and ACR integration during the creation of your AKS cluster. To allow an AKS cluster to interact with ACR, an AAD **managed identity** is used. The following command allows you to authorize an existing ACR in your subscription and configures the appropriate **AcrPull** role for the managed identity. Supply valid values for your parameters below.
29+
You can set up AKS and ACR integration during the creation of your AKS cluster. To allow an AKS cluster to interact with ACR, an AAD **managed identity** is used.
30+
31+
If you don't already have an ACR, create one using the following command.
3032

3133
### [Azure CLI](#tab/azure-cli)
3234

@@ -35,21 +37,41 @@ You can set up AKS and ACR integration during the creation of your AKS cluster.
3537
3638
MYACR=myContainerRegistry
3739
38-
# If you don't already have an ACR, use the following command to create one.
39-
4040
az acr create -n $MYACR -g myContainerRegistryResourceGroup --sku basic
41+
```
42+
43+
### [Azure PowerShell][#tab/azure-powershell]
44+
45+
```azurepowershell
46+
# Set this variable to the name of your ACR. The name must be globally unique.
47+
48+
$MYACR = 'myContainerRegistry'
49+
50+
New-AzContainerRegistry -Name $MYACR -ResourceGroupName myContainerRegistryResourceGroup -Sku Basic
51+
```
52+
53+
---
54+
55+
If you have already have an ACR, use the following command to create a new AKS cluster with ACR integration. This command allows you to authorize an existing ACR in your subscription and configures the appropriate **AcrPull** role for the managed identity. Supply valid values for your parameters below.
56+
57+
### [Azure CLI](#tab/azure-cli)
58+
59+
```azurecli
60+
# Set this variable to the name of your ACR. The name must be globally unique.
61+
62+
MYACR=myContainerRegistry
4163
4264
# Create an AKS cluster with ACR integration.
4365
4466
az aks create -n myAKSCluster -g myResourceGroup --generate-ssh-keys --attach-acr $MYACR
4567
```
4668

47-
Alternatively, you can specify the ACR name using an ACR resource ID. The format is as follows:
69+
Alternatively, you can specify the ACR name using an ACR resource ID using the following format:
4870

4971
`/subscriptions/\<subscription-id\>/resourceGroups/\<resource-group-name\>/providers/Microsoft.ContainerRegistry/registries/\<name\>`
5072

5173
> [!NOTE]
52-
> If you're using an ACR located in a different subscription from your AKS cluster, use the ACR resource ID when attaching or detaching from the cluster.
74+
> If you're using an ACR located in a different subscription from your AKS cluster, use the ACR *resource ID* when attaching or detaching from the cluster.
5375
>
5476
> ```azurecli
5577
> az aks create -n myAKSCluster -g myResourceGroup --generate-ssh-keys --attach-acr /subscriptions/<subscription-id>/resourceGroups/myContainerRegistryResourceGroup/providers/Microsoft.ContainerRegistry/registries/myContainerRegistry
@@ -62,10 +84,6 @@ Alternatively, you can specify the ACR name using an ACR resource ID. The format
6284
6385
$MYACR = 'myContainerRegistry'
6486
65-
# If you don't already have an ACR, use the following command to create one.
66-
67-
New-AzContainerRegistry -Name $MYACR -ResourceGroupName myContainerRegistryResourceGroup -Sku Basic
68-
6987
# Create an AKS cluster with ACR integration.
7088
7189
New-AzAksCluster -Name myAKSCluster -ResourceGroupName myResourceGroup -GenerateSshKey -AcrNameToAttach $MYACR
@@ -77,47 +95,53 @@ This step may take several minutes to complete.
7795

7896
## Configure ACR integration for existing AKS clusters
7997

98+
### Attach an ACR to an AKS cluster
99+
80100
### [Azure CLI](#tab/azure-cli)
81101

82-
Integrate an existing ACR with existing AKS clusters by supplying valid values for **acr-name** or **acr-resource-id**.
102+
Integrate an existing ACR with an existing AKS cluster using the [`--attach-acr` parameter][cli-param] and valid values for **acr-name** or **acr-resource-id**.
83103

84104
```azurecli
105+
# Attach using acr-name
85106
az aks update -n myAKSCluster -g myResourceGroup --attach-acr <acr-name>
86-
```
87-
88-
or
89107
90-
```azurecli
108+
# Attach using acr-resource-id
91109
az aks update -n myAKSCluster -g myResourceGroup --attach-acr <acr-resource-id>
92110
```
93111

94112
> [!NOTE]
95113
> The `az aks update --attach-acr` command uses the permissions of the user running the command to create the ACR role assignment. This role is assigned to the [kubelet][kubelet] managed identity. For more information on AKS managed identities, see [Summary of managed identities][summary-msi].
96114
97-
You can also remove the integration between an ACR and an AKS cluster.
98-
99-
```azurecli
100-
az aks update -n myAKSCluster -g myResourceGroup --detach-acr <acr-name>
101-
```
102-
103-
or
104-
105-
```azurecli
106-
az aks update -n myAKSCluster -g myResourceGroup --detach-acr <acr-resource-id>
107-
```
108-
109115
### [Azure PowerShell](#tab/azure-powershell)
110116

111-
Integrate an existing ACR with existing AKS clusters by supplying valid values for **acr-name**.
117+
Integrate an existing ACR with an existing AKS cluster using the [`-AcrNameToAttach` parameter][ps-attach] and valid values for **acr-name**.
112118

113119
```azurepowershell
114120
Set-AzAksCluster -Name myAKSCluster -ResourceGroupName myResourceGroup -AcrNameToAttach <acr-name>
115121
```
116122

123+
---
124+
117125
> [!NOTE]
118126
> Running the `Set-AzAksCluster -AcrNameToAttach` cmdlet uses the permissions of the user running the command to create the role ACR assignment. This role is assigned to the [kubelet][kubelet] managed identity. For more information on AKS managed identities, see [Summary of managed identities][summary-msi].
119127
120-
You can also remove the integration between an ACR and an AKS cluster.
128+
### Detach an ACR from an AKS cluster
129+
130+
### [Azure CLI][#tab/azure-cli]
131+
132+
Remove the integration between an ACR and an AKS cluster using the [`--detach-acr` parameter][cli-param] and valid values for **acr-name** or **acr-resource-id**.
133+
134+
```azurecli
135+
# Detach using acr-name
136+
az aks update -n myAKSCluster -g myResourceGroup --detach-acr <acr-name>
137+
138+
# Detach using acr-resource-id
139+
az aks update -n myAKSCluster -g myResourceGroup --detach-acr <acr-resource-id>
140+
```
141+
142+
### [Azure PowerShell][#tab/azure-powershell]
143+
144+
Remove the integration between an ACR and an AKS cluster using the [`-AcrNameToDetach` parameter][ps-detach] and valid values for **acr-name**.
121145

122146
```azurepowershell
123147
Set-AzAksCluster -Name myAKSCluster -ResourceGroupName myResourceGroup -AcrNameToDetach <acr-name>
@@ -163,7 +187,7 @@ Import-AzAksCredential -ResourceGroupName myResourceGroup -Name myAKSCluster
163187

164188
---
165189

166-
Create a file called **acr-nginx.yaml** using the sample YAML below. Substitute the resource name of your registry for **acr-name**, such as *myContainerRegistry*.
190+
Create a file called **acr-nginx.yaml** using the sample YAML below. Replace **acr-name** with the name of your ACR.
167191

168192
```yaml
169193
apiVersion: apps/v1
@@ -227,3 +251,6 @@ nginx0-deployment-669dfc4d4b-xdpd6 1/1 Running 0 20s
227251
[rbac-owner]: ../role-based-access-control/built-in-roles#owner
228252
[rbac-classic]: ../role-based-access-control/rbac-and-directory-admin-roles#classic-subscription-administrator-roles
229253
[kubelet]: https://kubernetes.io/docs/reference/command-line-tools-reference/kubelet/
254+
[ps-detach]: /powershell/module/az.aks/set-azakscluster?view=azps-9.1.0#-acrnametodetach
255+
[cli-param]: /cli/azure/aks?view=azure-cli-latest#az-aks-update-optional-parameters
256+
[ps-attach]: /powershell/module/az.aks/set-azakscluster?view=azps-9.1.0#-acrnametoattach

0 commit comments

Comments
 (0)