Skip to content

Commit e528a0b

Browse files
Merge pull request #272344 from schaffererin/userstory245697
Changed credentials to placeholder to avoid MSRC security issue
2 parents 742b4c1 + 54e9614 commit e528a0b

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

articles/aks/update-credentials.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
title: Update or rotate the credentials for an Azure Kubernetes Service (AKS) cluster
33
description: Learn how update or rotate the service principal or Microsoft Entra Application credentials for an Azure Kubernetes Service (AKS) cluster.
4+
ms.author: schaffererin
5+
author: schaffererin
46
ms.topic: article
57
ms.subservice: aks-security
68
ms.custom: devx-track-azurecli
@@ -30,23 +32,23 @@ When you want to update the credentials for an AKS cluster, you can choose to ei
3032
3133
### Check the expiration date of your service principal
3234

33-
To check the expiration date of your service principal, use the [`az ad app credential list`][az-ad-app-credential-list] command. The following example gets the service principal ID for the cluster named *myAKSCluster* in the *myResourceGroup* resource group using the [`az aks show`][az-aks-show] command. The service principal ID is set as a variable named *SP_ID*.
35+
To check the expiration date of your service principal, use the [`az ad app credential list`][az-ad-app-credential-list] command. The following example gets the service principal ID for the `$CLUSTER_NAME` cluster in the `$RESOURCE_GROUP_NAME` resource group using the [`az aks show`][az-aks-show] command. The service principal ID is set as a variable named *SP_ID*.
3436

3537
```azurecli
36-
SP_ID=$(az aks show --resource-group myResourceGroup --name myAKSCluster \
38+
SP_ID=$(az aks show --resource-group $RESOURCE_GROUP_NAME --name $CLUSTER_NAME \
3739
--query servicePrincipalProfile.clientId -o tsv)
3840
az ad app credential list --id "$SP_ID" --query "[].endDateTime" -o tsv
3941
```
4042

4143
### Reset the existing service principal credentials
4244

43-
To update the credentials for an existing service principal, get the service principal ID of your cluster using the [`az aks show`][az-aks-show] command. The following example gets the ID for the cluster named *myAKSCluster* in the *myResourceGroup* resource group. The variable named *SP_ID* stores the service principal ID used in the next step. These commands use the Bash command language.
45+
To update the credentials for an existing service principal, get the service principal ID of your cluster using the [`az aks show`][az-aks-show] command. The following example gets the ID for the `$CLUSTER_NAME` cluster in the `$RESOURCE_GROUP_NAME` resource group. The variable named *SP_ID* stores the service principal ID used in the next step. These commands use the Bash command language.
4446

4547
> [!WARNING]
4648
> When you reset your cluster credentials on an AKS cluster that uses Azure Virtual Machine Scale Sets, a [node image upgrade][node-image-upgrade] is performed to update your nodes with the new credential information.
4749
4850
```azurecli-interactive
49-
SP_ID=$(az aks show --resource-group myResourceGroup --name myAKSCluster \
51+
SP_ID=$(az aks show --resource-group $RESOURCE_GROUP_NAME --name $CLUSTER_NAME \
5052
--query servicePrincipalProfile.clientId -o tsv)
5153
```
5254

@@ -66,25 +68,25 @@ Next, you [update AKS cluster with service principal credentials][update-cluster
6668
To create a service principal and update the AKS cluster to use the new credential, use the [`az ad sp create-for-rbac`][az-ad-sp-create] command.
6769

6870
```azurecli-interactive
69-
az ad sp create-for-rbac --role Contributor --scopes /subscriptions/mySubscriptionID
71+
az ad sp create-for-rbac --role Contributor --scopes /subscriptions/$SUBSCRIPTION_ID
7072
```
7173

7274
The output is similar to the following example output. Make a note of your own `appId` and `password` to use in the next step.
7375

7476
```json
7577
{
76-
"appId": "7d837646-b1f3-443d-874c-fd83c7c739c5",
77-
"name": "7d837646-b1f3-443d-874c-fd83c7c739c",
78-
"password": "a5ce83c9-9186-426d-9183-614597c7f2f7",
79-
"tenant": "a4342dc8-cd0e-4742-a467-3129c469d0e5"
78+
"appId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
79+
"name": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
80+
"password": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
81+
"tenant": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
8082
}
8183
```
8284

8385
Define variables for the service principal ID and client secret using your output from running the [`az ad sp create-for-rbac`][az-ad-sp-create] command. The *SP_ID* is the *appId*, and the *SP_SECRET* is your *password*.
8486

8587
```console
86-
SP_ID=7d837646-b1f3-443d-874c-fd83c7c739c5
87-
SP_SECRET=a5ce83c9-9186-426d-9183-614597c7f2f7
88+
SP_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
89+
SP_SECRET=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
8890
```
8991

9092
Next, you [update AKS cluster with the new service principal credential][update-cluster-service-principal-credentials]. This step is necessary to update the AKS cluster with the new service principal credential.
@@ -98,8 +100,8 @@ Update the AKS cluster with your new or existing credentials by running the [`az
98100

99101
```azurecli-interactive
100102
az aks update-credentials \
101-
--resource-group myResourceGroup \
102-
--name myAKSCluster \
103+
--resource-group $RESOURCE_GROUP_NAME \
104+
--name $CLUSTER_NAME \
103105
--reset-service-principal \
104106
--service-principal "$SP_ID" \
105107
--client-secret "${SP_SECRET}"
@@ -113,12 +115,12 @@ You can create new Microsoft Entra server and client applications by following t
113115

114116
```azurecli-interactive
115117
az aks update-credentials \
116-
--resource-group myResourceGroup \
117-
--name myAKSCluster \
118+
--resource-group $RESOURCE_GROUP_NAME \
119+
--name $CLUSTER_NAME \
118120
--reset-aad \
119-
--aad-server-app-id <SERVER APPLICATION ID> \
120-
--aad-server-app-secret <SERVER APPLICATION SECRET> \
121-
--aad-client-app-id <CLIENT APPLICATION ID>
121+
--aad-server-app-id $SERVER_APPLICATION_ID \
122+
--aad-server-app-secret $SERVER_APPLICATION_SECRET \
123+
--aad-client-app-id $CLIENT_APPLICATION_ID
122124
```
123125

124126
## Next steps

0 commit comments

Comments
 (0)