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
Copy file name to clipboardExpand all lines: articles/aks/update-credentials.md
+17-15Lines changed: 17 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Update or rotate the credentials for an Azure Kubernetes Service (AKS) cluster
3
3
description: Learn how update or rotate the service principal or Azure AD Application credentials for an Azure Kubernetes Service (AKS) cluster.
4
4
ms.topic: article
5
-
ms.date: 02/28/2023
5
+
ms.date: 03/01/2023
6
6
---
7
7
8
8
# 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
14
14
15
15
## Before you begin
16
16
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].
18
18
19
19
## Update or create a new service principal for your AKS cluster
20
20
@@ -38,7 +38,7 @@ az ad app credential list --id "$SP_ID" --query "[].endDateTime" -o tsv
38
38
39
39
### Reset the existing service principal credentials
40
40
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.
42
42
43
43
> [!WARNING]
44
44
> 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,20 +48,20 @@ SP_ID=$(az aks show --resource-group myResourceGroup --name myAKSCluster \
48
48
--query servicePrincipalProfile.clientId -o tsv)
49
49
```
50
50
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*.
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 service principal credentials][update-cluster-service-principal-credentials]. This step is necessary to update the service principal on your AKS cluster.
58
58
59
59
### Create a new service principal
60
60
61
61
> [!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).
62
+
> If you updated the existing service principal credentials in the previous section, skip this section and instead [update the AKS cluster with service principal credentials][update-cluster-service-principal-credentials].
63
63
64
-
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.
64
+
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.
65
65
66
66
```azurecli-interactive
67
67
az ad sp create-for-rbac --role Contributor --scopes /subscriptions/mySubscriptionID
@@ -78,21 +78,21 @@ The output is similar to the following example output. Make a note of your own `
78
78
}
79
79
```
80
80
81
-
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 your*appId*, and the *SP_SECRET* is your *password*.
81
+
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*.
82
82
83
83
```console
84
84
SP_ID=7d837646-b1f3-443d-874c-fd83c7c739c5
85
85
SP_SECRET=a5ce83c9-9186-426d-9183-614597c7f2f7
86
86
```
87
87
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.
88
+
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.
89
89
90
-
## Update AKS cluster with new service principal credentials
90
+
## Update AKS cluster with service principal credentials
91
91
92
-
>[!IMPORTANT]
93
-
>For large clusters, updating the 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 cluster updates and upgrades. For small and midsize clusters, it takes a few moments for the new credentials to update in the cluster.
92
+
>[!IMPORTANT]
93
+
>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.
94
94
95
-
Update the AKS cluster with your new credentials using the [`az aks update-credentials`][az-aks-update-credentials] command.
95
+
Update the AKS cluster with your new or existing credentials by running the [`az aks update-credentials`][az-aks-update-credentials] command.
96
96
97
97
```azurecli-interactive
98
98
az aks update-credentials \
@@ -105,7 +105,7 @@ az aks update-credentials \
105
105
106
106
## Update AKS cluster with new Azure AD application credentials
107
107
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.
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-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.
109
109
110
110
```azurecli-interactive
111
111
az aks update-credentials \
@@ -119,7 +119,7 @@ az aks update-credentials \
119
119
120
120
## Next steps
121
121
122
-
In this article, you learned how to update or rotate service principal and Azure AD application credentials. For more information on how to manage identity for workloads within an AKS cluster, see [Best practices for authentication and authorization in AKS][best-practices-identity].
122
+
In this article, you learned how to update or rotate service principal and Azure AD application credentials. For more information on how to use a manage identity for workloads within an AKS cluster, see [Best practices for authentication and authorization in AKS][best-practices-identity].
123
123
124
124
<!-- LINKS - internal -->
125
125
[install-azure-cli]: /cli/azure/install-azure-cli
@@ -133,3 +133,5 @@ In this article, you learned how to update or rotate service principal and Azure
Copy file name to clipboardExpand all lines: articles/container-registry/authenticate-aks-cross-tenant.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,7 +68,7 @@ In **Tenant B**, assign the AcrPull role to the service principal, scoped to the
68
68
69
69
### Step 4: Update AKS with the Azure AD application secret
70
70
71
-
Use the multitenant application (client) ID and client secret collected in Step 1 to [update the AKS service principal credential](../aks/update-credentials.md#update-aks-cluster-with-new-service-principal-credentials).
71
+
Use the multitenant application (client) ID and client secret collected in Step 1 to [update the AKS service principal credential](../aks/update-credentials.md#update-aks-cluster-with-service-principal-credentials).
72
72
73
73
Updating the service principal can take several minutes.
0 commit comments