Skip to content

Commit 31c5c92

Browse files
committed
Revised steps for update SPN credentials
1 parent 1c029a7 commit 31c5c92

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

articles/aks/update-credentials.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
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 Azure AD Application credentials for an Azure Kubernetes Service (AKS) cluster.
44
ms.topic: article
5-
ms.date: 02/28/2023
5+
ms.date: 03/01/2023
66
---
77

88
# Update or rotate the credentials for an Azure Kubernetes Service (AKS) cluster
@@ -14,7 +14,7 @@ AKS clusters created with a service principal have a one-year expiration time. A
1414
1515
## Before you begin
1616

17-
You need the Azure CLI version 2.0.65 or later installed and configured. Run `az --version` to find the version. If you need to install or upgrade, see [Install Azure CLI][install-azure-cli].
17+
You need the Azure CLI version 2.0.65 or later installed and configured. Run `az --version` to find the version. If you need to install or upgrade, see [Install Azure CLI][install-azure-cli].
1818

1919
## Update or create a new service principal for your AKS cluster
2020

@@ -38,7 +38,7 @@ az ad app credential list --id "$SP_ID" --query "[].endDateTime" -o tsv
3838

3939
### Reset the existing service principal credentials
4040

41-
To update the credentials for the 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 service principal ID is set as a variable named *SP_ID* to use in additional command. These commands use Bash syntax.
41+
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.
4242

4343
> [!WARNING]
4444
> 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.
@@ -48,18 +48,21 @@ SP_ID=$(az aks show --resource-group myResourceGroup --name myAKSCluster \
4848
--query servicePrincipalProfile.clientId -o tsv)
4949
```
5050

51-
Use the variable containing the service principal ID to reset the credentials using the [`az ad app credential reset`][az-ad-app-credential-reset] command. The following example enables the Azure platform to generate a new secure secret for the service principal and stores it as a variable named *SP_SECRET*.
51+
Use the variable *SP_ID* containing the service principal ID to reset the credentials using the [`az ad app credential reset`][az-ad-app-credential-reset] command. The following example enables the Azure platform to generate a new secure secret for the service principal and store it as a variable named *SP_SECRET*.
5252

5353
```azurecli-interactive
5454
SP_SECRET=$(az ad app credential reset --id "$SP_ID" --query password -o tsv)
5555
```
5656

57-
Next, you can [update AKS cluster with new service principal credentials](#update-aks-cluster-with-new-service-principal-credentials). This step is necessary for the Service Principal changes to reflect on the AKS cluster.
57+
Next, you [update AKS cluster with new service principal credentials][update-cluster-new-service-principal-credentials]. This step is necessary to update the service principal on your AKS cluster.
58+
59+
>[!IMPORTANT]
60+
>For large clusters, updating your AKS cluster with a new service principal may take a long time to complete. Consider reviewing and customizing the [node surge upgrade settings][node-surge-upgrade] to minimize disruption during the update. For small and midsize clusters, it takes a several minutes for the new credentials to update in the cluster.
5861
5962
### Create a new service principal
6063

6164
> [!NOTE]
62-
> If you updated the existing service principal credentials in the previous section, skip this section and instead [update the AKS cluster with new service principal credentials](#update-aks-cluster-with-new-service-principal-credentials).
65+
> If you updated the existing service principal credentials in the previous section, skip this section and instead [update the AKS cluster with new service principal credentials][update-cluster-new-service-principal-credentials].
6366
6467
To create a service principal and update the AKS cluster to use the new credentials, use the [`az ad sp create-for-rbac`][az-ad-sp-create] command.
6568

@@ -85,7 +88,7 @@ SP_ID=7d837646-b1f3-443d-874c-fd83c7c739c5
8588
SP_SECRET=a5ce83c9-9186-426d-9183-614597c7f2f7
8689
```
8790

88-
Next, you can [update AKS cluster with new service principal credentials](#update-aks-cluster-with-new-service-principal-credentials). This step is necessary for the Service Principal changes to reflect on the AKS cluster.
91+
Next, you can [update AKS cluster with new service principal credentials][update-cluster-new-service-principal-credentials]. This step is necessary for the Service Principal changes to reflect on the AKS cluster.
8992

9093
## Update AKS cluster with new service principal credentials
9194

@@ -105,7 +108,7 @@ az aks update-credentials \
105108

106109
## Update AKS cluster with new Azure AD application credentials
107110

108-
You can create new Azure AD server and client applications by following the [Azure AD integration steps][create-aad-app], or reset your existing Azure AD applications following the [same method as for service principal reset](#reset-the-existing-service-principal-credentials). After that, you need to update your cluster Azure AD application credentials using the [`az aks update-credentials`][az-aks-update-credentials] command with the *--reset-aad* variables.
111+
You can create new Azure AD server and client applications by following the [Azure AD integration steps][create-aad-app], or reset your existing Azure AD applications following the [same method as for service principal reset][reset-existing-service-principal-credentials]. After that, you need to update your cluster Azure AD application credentials using the [`az aks update-credentials`][az-aks-update-credentials] command with the *--reset-aad* variables.
109112

110113
```azurecli-interactive
111114
az aks update-credentials \
@@ -133,3 +136,5 @@ In this article, you learned how to update or rotate service principal and Azure
133136
[az-ad-app-credential-reset]: /cli/azure/ad/app/credential#az_ad_app_credential_reset
134137
[node-image-upgrade]: ./node-image-upgrade.md
135138
[node-surge-upgrade]: upgrade-cluster.md#customize-node-surge-upgrade
139+
[update-cluster-new-service-principal-credentials]: #update-aks-cluster-with-new-service-principal-credentials
140+
[reset-existing-service-principal-credentials]: #reset-the-existing-service-principal-credentials

0 commit comments

Comments
 (0)