Skip to content

Commit 5e5b745

Browse files
committed
reset aad credentials
1 parent 884ebd7 commit 5e5b745

File tree

2 files changed

+30
-11
lines changed

2 files changed

+30
-11
lines changed

articles/aks/TOC.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@
216216
href: api-server-authorized-ip-ranges.md
217217
- name: Control deployments with Azure Policy (preview)
218218
href: ../governance/policy/concepts/rego-for-aks.md?toc=/azure/aks/toc.json
219-
- name: Update cluster service principal credentials
219+
- name: Update cluster credentials
220220
href: update-credentials.md
221221
- name: Restrict and control cluster egress traffic
222222
href: limit-egress-traffic.md

articles/aks/update-credentials.md

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
11
---
22
title: Reset the credentials for an Azure Kubernetes Service (AKS) cluster
3-
description: Learn how update or reset the service principal credentials for a cluster in Azure Kubernetes Service (AKS)
3+
description: Learn how update or reset the service principal or AAD Application credentials for an Azure Kubernetes Service (AKS) cluster
44
services: container-service
55
ms.topic: article
6-
ms.date: 05/31/2019
6+
ms.date: 03/11/2019
77

88
---
99

10-
# Update or rotate the credentials for a service principal in Azure Kubernetes Service (AKS)
10+
# Update or rotate the credentials for Azure Kubernetes Service (AKS)
1111

1212
By default, AKS clusters are created with a service principal that has a one-year expiration time. As you near the expiration date, you can reset the credentials to extend the service principal for an additional period of time. You may also want to update, or rotate, the credentials as part of a defined security policy. This article details how to update these credentials for an AKS cluster.
1313

14+
You may also have [integrated your AKS cluster with Azure Active Directory][aad-integration], and use it as an authentication provider for your cluster. In that case you will have 2 more identities created for your cluster, the AAD Server App and the AAD Client App, you may also reset those credentials.
15+
1416
## Before you begin
1517

1618
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].
1719

18-
## Choose to update or create a service principal
20+
## Update or create a new Service Principal for your AKS cluster
1921

2022
When you want to update the credentials for an AKS cluster, you can choose to:
2123

2224
* update the credentials for the existing service principal used by the cluster, or
2325
* create a service principal and update the cluster to use these new credentials.
2426

25-
### Update Existing Service Principal Expiration
27+
### Reset Existing Service Principal Credential
2628

2729
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* for use in additional command.
2830

@@ -37,11 +39,11 @@ With a variable set that contains the service principal ID, now reset the creden
3739
SP_SECRET=$(az ad sp credential reset --name $SP_ID --query password -o tsv)
3840
```
3941

40-
Now continue on to [update AKS cluster with new credentials](#update-aks-cluster-with-new-credentials). This step is necessary for the Service Principal changes to reflect on the AKS cluster.
42+
Now continue on to [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.
4143

4244
### Create a New Service Principal
4345

44-
If you chose to update the existing service principal credentials in the previous section, skip this step. Continue to [update AKS cluster with new credentials](#update-aks-cluster-with-new-credentials).
46+
If you chose to update the existing service principal credentials in the previous section, skip this step. Continue to [update AKS cluster with new service principal credentials](#update-aks-cluster-with-new-service-principal-credentials).
4547

4648
To create a service principal and then update the AKS cluster to use these new credentials, use the [az ad sp create-for-rbac][az-ad-sp-create] command. In the following example, the `--skip-assignment` parameter prevents any additional default assignments being assigned:
4749

@@ -67,9 +69,9 @@ SP_ID=7d837646-b1f3-443d-874c-fd83c7c739c5
6769
SP_SECRET=a5ce83c9-9186-426d-9183-614597c7f2f7
6870
```
6971

70-
Now continue on to [update AKS cluster with new credentials](#update-aks-cluster-with-new-credentials). This step is necessary for the Service Principal changes to reflect on the AKS cluster.
72+
Now continue on to [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.
7173

72-
## Update AKS cluster with new credentials
74+
## Update AKS cluster with new Service Principal credentials
7375

7476
Regardless of whether you chose to update the credentials for the existing service principal or create a service principal, you now update the AKS cluster with your new credentials using the [az aks update-credentials][az-aks-update-credentials] command. The variables for the *--service-principal* and *--client-secret* are used:
7577

@@ -84,14 +86,31 @@ az aks update-credentials \
8486

8587
It takes a few moments for the service principal credentials to be updated in the AKS.
8688

89+
## Update AKS Cluster with new AAD Application credentials
90+
91+
You may create new AAD Server and Client applications by following the [AAD integration steps][create-aad-app]. Or reset your existing AAD Applications following the [same method as for service principal reset](#reset-existing-service-principal-credential). After that you just need to update your cluster AAD Application credentials using the same [az aks update-credentials][az-aks-update-credentials] command but using the *--reset-aad* variables.
92+
93+
```azurecli-interactive
94+
az aks update-credentials \
95+
--resource-group myResourceGroup \
96+
--name myAKSCluster \
97+
--reset-aad \
98+
--aad-server-app-id <SERVER APPLICATION ID> \
99+
--aad-server-app-secret <SERVER APPLICATION SECRET> \
100+
--aad-client-app-id <CLIENT APPLICATION ID>
101+
```
102+
103+
87104
## Next steps
88105

89-
In this article, the service principal for the AKS cluster itself was updated. For more information on how to manage identity for workloads within a cluster, see [Best practices for authentication and authorization in AKS][best-practices-identity].
106+
In this article, the service principal for the AKS cluster itself and the AAD Integration Applications were updated. For more information on how to manage identity for workloads within a cluster, see [Best practices for authentication and authorization in AKS][best-practices-identity].
90107

91108
<!-- LINKS - internal -->
92109
[install-azure-cli]: /cli/azure/install-azure-cli
93110
[az-aks-show]: /cli/azure/aks#az-aks-show
94111
[az-aks-update-credentials]: /cli/azure/aks#az-aks-update-credentials
95112
[best-practices-identity]: operator-best-practices-identity.md
113+
[aad-integration]: azure-ad-integration.md
114+
[create-aad-app]: azure-ad-integration.md#create-the-server-application
96115
[az-ad-sp-create]: /cli/azure/ad/sp#az-ad-sp-create-for-rbac
97116
[az-ad-sp-credential-reset]: /cli/azure/ad/sp/credential#az-ad-sp-credential-reset

0 commit comments

Comments
 (0)