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
@@ -79,68 +79,25 @@ az network vnet subnet create \
79
79
--address-prefixes 10.241.0.0/16
80
80
```
81
81
82
-
## Create a service principal or use a managed identity
82
+
## Create an AKS cluster with managed identity
83
83
84
-
To allow an AKS cluster to interact with other Azure resources, a cluster identity is used. This cluster identity can be automatically created by the Azure CLI or portal, or you can pre-create one and assign additional permissions. By default, this cluster identity is a managed identity. For more information, see [Use managed identities](use-managed-identity.md). You can also use a service principal as your cluster identity. The following steps show you how to manually create and assign the service principal to your cluster.
85
-
86
-
Create a service principal using the [az ad sp create-for-rbac][az-ad-sp-create-for-rbac] command.
Make a note of the *appId* and *password*. These values are used in the following steps.
105
-
106
-
## Assign permissions to the virtual network
107
-
108
-
To allow your cluster to use and manage the virtual network, you must grant the AKS service principal the correct rights to use the network resources.
109
-
110
-
First, get the virtual network resource ID using [az network vnet show][az-network-vnet-show]:
111
-
112
-
```azurecli-interactive
113
-
az network vnet show --resource-group myResourceGroup --name myVnet --query id -o tsv
114
-
```
115
-
116
-
To grant the correct access for the AKS cluster to use the virtual network, create a role assignment using the [az role assignment create][az-role-assignment-create] command. Replace `<appId`> and `<vnetId>` with the values gathered in the previous two steps.
117
-
118
-
```azurecli-interactive
119
-
az role assignment create --assignee <appId> --scope <vnetId> --role Contributor
120
-
```
121
-
122
-
## Create an AKS cluster
84
+
Instead of using a system-assigned identity, you can also use a user-assigned identity. For more information, see [Use managed identities](use-managed-identity.md).
123
85
124
86
You deploy an AKS cluster into the AKS subnet created in a previous step. Get the ID of this subnet using [az network vnet subnet show][az-network-vnet-subnet-show]:
125
87
126
88
```azurecli-interactive
127
89
az network vnet subnet show --resource-group myResourceGroup --vnet-name myVnet --name myAKSSubnet --query id -o tsv
128
90
```
129
91
130
-
Use the [az aks create][az-aks-create] command to create an AKS cluster. The following example creates a cluster named *myAKSCluster* with one node. Replace `<subnetId>` with the ID obtained in the previous step, and then `<appId>` and `<password>` with the values gathered in the previous section.
92
+
Use the [az aks create][az-aks-create] command to create an AKS cluster. The following example creates a cluster named *myAKSCluster* with one node. Replace `<subnetId>` with the ID obtained in the previous step.
131
93
132
94
```azurecli-interactive
133
95
az aks create \
134
96
--resource-group myResourceGroup \
135
97
--name myAKSCluster \
136
98
--node-count 1 \
137
99
--network-plugin azure \
138
-
--service-cidr 10.0.0.0/16 \
139
-
--dns-service-ip 10.0.0.10 \
140
-
--docker-bridge-address 172.17.0.1/16 \
141
100
--vnet-subnet-id <subnetId> \
142
-
--service-principal <appId> \
143
-
--client-secret <password>
144
101
```
145
102
146
103
After several minutes, the command completes and returns JSON-formatted information about the cluster.
0 commit comments