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
1. Get the `objectId` associated with your Microsoft Entra entity.
89
+
1. Get the `objectId` associated with your Microsoft Entra entity. If you are using a single user account, get the user principal name (UPN) associated with your Microsoft Entra entity.
90
90
91
-
- For a Microsoft Entra user account:
91
+
- For a Microsoft Entra group account:
92
+
93
+
```azurecli
94
+
AAD_ENTITY_ID=$(az ad signed-in-user show --query id -o tsv)
95
+
```
96
+
97
+
- For a Microsoft Entra single user account:
92
98
93
99
```azurecli
94
-
AAD_ENTITY_OBJECT_ID=$(az ad signed-in-user show --query id -o tsv)
100
+
AAD_ENTITY_ID=$(az ad signed-in-user show --query userPrincipalName -o tsv)
95
101
```
96
102
97
103
- For a Microsoft Entra application:
98
104
99
105
```azurecli
100
-
AAD_ENTITY_OBJECT_ID=$(az ad sp show --id <id> --query id -o tsv)
106
+
AAD_ENTITY_ID=$(az ad sp show --id <id> --query id -o tsv)
101
107
```
102
108
103
109
1. Authorize the entity with appropriate permissions.
104
110
105
111
- If you're using Kubernetes native ClusterRoleBinding or RoleBinding for authorization checks on the cluster, with the `kubeconfig` file pointing to the `apiserver` of your cluster for direct access, you can create one mapped to the Microsoft Entra entity (service principal or user) that needs to access this cluster. For example:
- If you're using Azure RBAC for authorization checks on the cluster, you can create an applicable [Azure role assignment](azure-rbac.md#built-in-roles) mapped to the Microsoft Entra entity. For example:
112
118
113
119
```azurecli
114
-
az role assignment create --role "Azure Arc Kubernetes Viewer" --assignee $AAD_ENTITY_OBJECT_ID --scope $ARM_ID_CLUSTER
115
-
az role assignment create --role "Azure Arc Enabled Kubernetes Cluster User Role" --assignee $AAD_ENTITY_OBJECT_ID --scope $ARM_ID_CLUSTER
120
+
az role assignment create --role "Azure Arc Kubernetes Viewer" --assignee $AAD_ENTITY_ID --scope $ARM_ID_CLUSTER
121
+
az role assignment create --role "Azure Arc Enabled Kubernetes Cluster User Role" --assignee $AAD_ENTITY_ID --scope $ARM_ID_CLUSTER
116
122
```
117
123
118
124
#### [Azure PowerShell](#tab/azure-powershell)
119
125
120
-
1. Get the `objectId` associated with your Microsoft Entra entity.
126
+
1. Get the `objectId` associated with your Microsoft Entra entity. If you are using a single user account, you will get the user principal name (UPN) associated with your Microsoft Entra entity.
121
127
122
-
- For a Microsoft Entra user account:
128
+
- For a Microsoft Entra group account:
123
129
124
130
```azurepowershell
125
-
$AAD_ENTITY_OBJECT_ID = (az ad signed-in-user show --query id -o tsv)
131
+
$AAD_ENTITY_ID = (az ad signed-in-user show --query id -o tsv)
126
132
```
127
133
134
+
- For a Microsoft Entra single user account:
135
+
136
+
```azurepowershell
137
+
$AAD_ENTITY_ID = (az ad signed-in-user show --query userPrincipalName -o tsv)
138
+
```
139
+
128
140
- For a Microsoft Entra application:
129
141
130
-
```azurepowershell
131
-
$AAD_ENTITY_OBJECT_ID = (az ad sp show --id <id> --query objectId -o tsv)
132
-
```
142
+
```azurepowershell
143
+
$AAD_ENTITY_ID = (az ad sp show --id <id> --query objectId -o tsv)
144
+
```
133
145
134
146
1. Authorize the entity with appropriate permissions.
135
147
136
-
- If you're using Kubernetes native ClusterRoleBinding or RoleBinding for authorization checks on the cluster, with the `kubeconfig` file pointing to the `apiserver` of your cluster for direct access, you can create one mapped to the Microsoft Entra entity (service principal or user) that needs to access this cluster. For example:
148
+
- If you're using native Kubernetes ClusterRoleBinding or RoleBinding for authorization checks on the cluster, with the `kubeconfig` file pointing to the `apiserver` of your cluster for direct access, you can create one mapped to the Microsoft Entra entity (service principal or user) that needs to access this cluster. For example:
- If you're using [Azure RBAC for authorization checks](azure-rbac.md) on the cluster, you can create an applicable [Azure role assignment](azure-rbac.md#built-in-roles) mapped to the Microsoft Entra entity. For example:
143
155
144
156
```azurepowershell
145
157
146
-
az role assignment create --role "Azure Arc Kubernetes Viewer" --assignee $AAD_ENTITY_OBJECT_ID --scope $ARM_ID_CLUSTER
147
-
az role assignment create --role "Azure Arc Enabled Kubernetes Cluster User Role" --assignee $AAD_ENTITY_OBJECT_ID --scope $ARM_ID_CLUSTER
158
+
az role assignment create --role "Azure Arc Kubernetes Viewer" --assignee $AAD_ENTITY_ID --scope $ARM_ID_CLUSTER
159
+
az role assignment create --role "Azure Arc Enabled Kubernetes Cluster User Role" --assignee $AAD_ENTITY_ID --scope $ARM_ID_CLUSTER
0 commit comments