@@ -17,7 +17,7 @@ aksResourceGroupName="${aksPrefix}RG"
17
17
location=" WestEurope"
18
18
19
19
# Name and resource group name of the Azure Container Registry used by the AKS cluster.
20
- # The name of the cluster is also used to create or select an existing admin group in the Azure AD tenant.
20
+ # The name of the cluster is also used to create or select an existing admin group in the Microsoft Entra ID tenant.
21
21
acrName=" ${aksPrefix} Acr"
22
22
acrResourceGroupName=" $aksResourceGroupName "
23
23
acrSku=" Standard"
@@ -251,17 +251,17 @@ else
251
251
fi
252
252
253
253
# Get the user principal name of the current user
254
- echo " Retrieving the user principal name of the current user from the [$tenantId ] Azure AD tenant..."
254
+ echo " Retrieving the user principal name of the current user from the [$tenantId ] Microsoft Entra ID tenant..."
255
255
userPrincipalName=$( az account show --query user.name --output tsv)
256
256
if [[ -n $userPrincipalName ]]; then
257
- echo " [$userPrincipalName ] user principal name successfully retrieved from the [$tenantId ] Azure AD tenant"
257
+ echo " [$userPrincipalName ] user principal name successfully retrieved from the [$tenantId ] Microsoft Entra ID tenant"
258
258
else
259
- echo " Failed to retrieve the user principal name of the current user from the [$tenantId ] Azure AD tenant"
259
+ echo " Failed to retrieve the user principal name of the current user from the [$tenantId ] Microsoft Entra ID tenant"
260
260
exit
261
261
fi
262
262
263
- # Retrieve the objectId of the user in the Azure AD tenant used by AKS for user authentication
264
- echo " Retrieving the objectId of the [$userPrincipalName ] user principal name from the [$tenantId ] Azure AD tenant..."
263
+ # Retrieve the objectId of the user in the Microsoft Entra ID tenant used by AKS for user authentication
264
+ echo " Retrieving the objectId of the [$userPrincipalName ] user principal name from the [$tenantId ] Microsoft Entra ID tenant..."
265
265
userObjectId=$( az ad user show --upn-or-object-id $userPrincipalName --query objectId --output tsv 2> /dev/null)
266
266
267
267
if [[ -n $userObjectId ]]; then
@@ -286,30 +286,30 @@ else
286
286
exit
287
287
fi
288
288
289
- # Assign Azure Kubernetes Service RBAC Admin role to the current user
290
- echo " Checking if [$userPrincipalName ] user has been assigned to [Azure Kubernetes Service RBAC Admin] role on the [$aksName ] AKS cluster..."
289
+ # Assign Azure Kubernetes Service RBAC Cluster Admin role to the current user
290
+ echo " Checking if [$userPrincipalName ] user has been assigned to [Azure Kubernetes Service RBAC Cluster Admin] role on the [$aksName ] AKS cluster..."
291
291
role=$( az role assignment list \
292
292
--assignee $userObjectId \
293
293
--scope $aksClusterId \
294
294
--query [? roleDefinitionName].roleDefinitionName \
295
295
--output tsv 2> /dev/null)
296
296
297
- if [[ $role == " Owner" ]] || [[ $role == " Contributor" ]] || [[ $role == " Azure Kubernetes Service RBAC Admin" ]]; then
297
+ if [[ $role == " Owner" ]] || [[ $role == " Contributor" ]] || [[ $role == " Azure Kubernetes Service RBAC Cluster Admin" ]]; then
298
298
echo " [$userPrincipalName ] user is already assigned to the [$role ] role on the [$aksName ] AKS cluster"
299
299
else
300
- echo " [$userPrincipalName ] user is not assigned to the [Azure Kubernetes Service RBAC Admin] role on the [$aksName ] AKS cluster"
301
- echo " Assigning the [$userPrincipalName ] user to the [Azure Kubernetes Service RBAC Admin] role on the [$aksName ] AKS cluster..."
300
+ echo " [$userPrincipalName ] user is not assigned to the [Azure Kubernetes Service RBAC Cluster Admin] role on the [$aksName ] AKS cluster"
301
+ echo " Assigning the [$userPrincipalName ] user to the [Azure Kubernetes Service RBAC Cluster Admin] role on the [$aksName ] AKS cluster..."
302
302
303
303
az role assignment create \
304
- --role " Azure Kubernetes Service RBAC Admin" \
304
+ --role " Azure Kubernetes Service RBAC Cluster Admin" \
305
305
--assignee $userObjectId \
306
306
--scope $aksClusterId \
307
307
--only-show-errors 1> /dev/null
308
308
309
309
if [[ $? == 0 ]]; then
310
- echo " [$userPrincipalName ] user successfully assigned to the [Azure Kubernetes Service RBAC Admin] role on the [$aksName ] AKS cluster"
310
+ echo " [$userPrincipalName ] user successfully assigned to the [Azure Kubernetes Service RBAC Cluster Admin] role on the [$aksName ] AKS cluster"
311
311
else
312
- echo " Failed to assign the [$userPrincipalName ] user to the [Azure Kubernetes Service RBAC Admin] role on the [$aksName ] AKS cluster"
312
+ echo " Failed to assign the [$userPrincipalName ] user to the [Azure Kubernetes Service RBAC Cluster Admin] role on the [$aksName ] AKS cluster"
313
313
exit
314
314
fi
315
315
fi
0 commit comments