Skip to content

Commit 9c70b7b

Browse files
authored
Merge pull request #200133 from CocoWang-wql/patch-7
Update the managed identity doc
2 parents 32dfeae + 619e7d2 commit 9c70b7b

File tree

1 file changed

+15
-30
lines changed

1 file changed

+15
-30
lines changed

articles/aks/use-managed-identity.md

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Use managed identities in Azure Kubernetes Service
33
description: Learn how to use managed identities in Azure Kubernetes Service (AKS)
44
ms.topic: article
5-
ms.date: 01/25/2022
5+
ms.date: 06/01/2022
66
---
77

88
# Use managed identities in Azure Kubernetes Service
@@ -17,6 +17,9 @@ You must have the following resource installed:
1717

1818
- The Azure CLI, version 2.23.0 or later
1919

20+
> [!NOTE]
21+
> AKS will create a kubelet MI in the Node resource group if you do not bring your own kubelet MI.
22+
2023
## Limitations
2124

2225
* Tenants move / migrate of managed identity enabled clusters isn't supported.
@@ -130,14 +133,15 @@ az aks show -g <RGName> -n <ClusterName> --query "identity"
130133
```
131134

132135
> [!NOTE]
133-
> For creating and using your own VNet, static IP address, or attached Azure disk where the resources are outside of the worker node resource group, use the PrincipalID of the cluster System Assigned Managed Identity to perform a role assignment. For more information on role assignment, see [Delegate access to other Azure resources](kubernetes-service-principal.md#delegate-access-to-other-azure-resources).
136+
> For creating and using your own VNet, static IP address, or attached Azure disk where the resources are outside of the worker node resource group, CLI will add the role assignement automatically. If you are using ARM template or other clients, you need to use the PrincipalID of the cluster System Assigned Managed Identity to perform a role assignment. For more information on role assignment, see [Delegate access to other Azure resources](kubernetes-service-principal.md#delegate-access-to-other-azure-resources).
134137
>
135138
> Permission grants to cluster Managed Identity used by Azure Cloud provider may take up 60 minutes to populate.
136139
137140

138141
## Bring your own control plane MI
139142
A custom control plane identity enables access to be granted to the existing identity prior to cluster creation. This feature enables scenarios such as using a custom VNET or outboundType of UDR with a pre-created managed identity.
140143

144+
141145
You must have the Azure CLI, version 2.15.1 or later installed.
142146

143147
### Limitations
@@ -149,29 +153,9 @@ If you don't have a managed identity yet, you should go ahead and create one for
149153
az identity create --name myIdentity --resource-group myResourceGroup
150154
```
151155

152-
Assign "Managed Identity Operator" role to the identity.
153-
156+
Azure CLI will automatically add required role assignment for control plane MI. If you are using ARM template or other clients, you need to create the role assignment manually.
154157
```azurecli-interactive
155-
az role assignment create --assignee <id> --role "Managed Identity Operator" --scope <id>
156-
157-
158-
The result should look like:
159-
160-
```output
161-
{
162-
"canDelegate": null,
163-
"condition": null,
164-
"conditionVersion": null,
165-
"description": null,
166-
"id": "/subscriptions/<subscriptionid>/resourcegroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myIdentity",
167-
"name": "myIdentity,
168-
"principalId": "<principalId>",
169-
"principalType": "ServicePrincipal",
170-
"resourceGroup": "myResourceGroup",
171-
"roleDefinitionId": "/subscriptions/<subscriptionid>/providers/Microsoft.Authorization/roleDefinitions/<definitionid>",
172-
"scope": "<resourceid>",
173-
"type": "Microsoft.Authorization/roleAssignments"
174-
}
158+
az role assignment create --assignee <control-plane-identity-object-id> --role "Managed Identity Operator" --scope <kubelet-identity-resource-id>
175159
```
176160

177161
If your managed identity is part of your subscription, you can use [az identity CLI command][az-identity-list] to query it.
@@ -218,6 +202,7 @@ A Kubelet identity enables access to be granted to the existing identity prior t
218202
> [!WARNING]
219203
> Updating kubelet MI will upgrade Nodepool, which causes downtime for your AKS cluster as the nodes in the nodepools will be cordoned/drained and then reimaged.
220204
205+
221206
### Prerequisites
222207

223208
- You must have the Azure CLI, version 2.26.0 or later installed.
@@ -283,7 +268,7 @@ az identity list --query "[].{Name:name, Id:id, Location:location}" -o table
283268

284269
### Create a cluster using kubelet identity
285270

286-
Now you can use the following command to create your cluster with your existing identities. Provide the control plane identity id via `assign-identity` and the kubelet managed identity via `assign-kubelet-identity`:
271+
Now you can use the following command to create your cluster with your existing identities. Provide the control plane identity resource ID via `assign-identity` and the kubelet managed identity via `assign-kubelet-identity`:
287272

288273
```azurecli-interactive
289274
az aks create \
@@ -295,8 +280,8 @@ az aks create \
295280
--dns-service-ip 10.2.0.10 \
296281
--service-cidr 10.2.0.0/24 \
297282
--enable-managed-identity \
298-
--assign-identity <identity-id> \
299-
--assign-kubelet-identity <kubelet-identity-id>
283+
--assign-identity <identity-resource-id> \
284+
--assign-kubelet-identity <kubelet-identity-resource-id>
300285
```
301286

302287
A successful cluster creation using your own kubelet managed identity contains the following output:
@@ -337,15 +322,15 @@ az upgrade
337322
```
338323
#### Updating your cluster with kubelet identity
339324

340-
Now you can use the following command to update your cluster with your existing identities. Provide the control plane identity id via `assign-identity` and the kubelet managed identity via `assign-kubelet-identity`:
325+
Now you can use the following command to update your cluster with your existing identities. Provide the control plane identity resource ID via `assign-identity` and the kubelet managed identity via `assign-kubelet-identity`:
341326

342327
```azurecli-interactive
343328
az aks update \
344329
--resource-group myResourceGroup \
345330
--name myManagedCluster \
346331
--enable-managed-identity \
347-
--assign-identity <identity-id> \
348-
--assign-kubelet-identity <kubelet-identity-id>
332+
--assign-identity <identity-resource-id> \
333+
--assign-kubelet-identity <kubelet-identity-resource-id>
349334
```
350335

351336
A successful cluster update using your own kubelet managed identity contains the following output:

0 commit comments

Comments
 (0)