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/azure-ad-rbac.md
+32-4Lines changed: 32 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ titleSuffix: Azure Kubernetes Service
4
4
description: Learn how to use Azure Active Directory group membership to restrict access to cluster resources using Kubernetes role-based access control (Kubernetes RBAC) in Azure Kubernetes Service (AKS)
5
5
services: container-service
6
6
ms.topic: article
7
-
ms.date: 03/17/2021
7
+
ms.date: 12/07/2022
8
8
9
9
---
10
10
@@ -18,7 +18,34 @@ This article shows you how to control access using Kubernetes RBAC in an AKS clu
18
18
19
19
This article assumes that you have an existing AKS cluster enabled with Azure AD integration. If you need an AKS cluster, see [Integrate Azure Active Directory with AKS][azure-ad-aks-cli].
20
20
21
-
You need the Azure CLI version 2.0.61 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].
21
+
Kubernetes RBAC is enabled by default during AKS cluster creation. If Kubernetes RBAC wasn't enabled when you originally deployed your cluster, you'll need to delete and recreate your cluster.
22
+
23
+
Consider the following basic requirements before continuing:
24
+
25
+
- The Azure CLI version 2.0.61 or later is installed and configured. Run `az --version` to find the version. If you need to install or upgrade, see [Install Azure CLI][install-azure-cli].
26
+
- If using Terraform, install [Terraform][terraform-on-azure] version 2.99.0 or later.
27
+
28
+
To verify if Kubernetes RBAC is enabled, you can check from Azure portal or Azure CLI.
29
+
30
+
#### [Azure portal](#tab/portal)
31
+
32
+
From your browser, sign in to the [Azure portal](https://portal.azure.com).
33
+
34
+
Navigate to Kubernetes services, and from the left-hand pane select **Cluster configuration**. On the page, under the section **Authentication and Authorization**, verify the option **Local accounts with Kubernetes RBAC** is shown.
35
+
36
+
:::image type="content" source="./media/azure-ad-rbac/rbac-portal.png" alt-text="Example of Authentication and Authorization page in Azure portal." lightbox="./media/azure-ad-rbac/rbac-portal.png":::
37
+
38
+
#### [Azure CLI](#tab/azure-cli)
39
+
40
+
To verify RBAC is enabled, you can use the `az aks show` command.
41
+
42
+
```azuecli
43
+
az aks show --resource-group myResourceGroup --name myAKSCluster`
44
+
```
45
+
46
+
The output will show that the value for `enableRbac` is `true`.
Now, let's test the expected permissions work when you create and manage resources in an AKS cluster. In these examples, you schedule and view pods in the user's assigned namespace. Then, you try to schedule and view pods outside of the assigned namespace.
282
309
283
-
First, reset the *kubeconfig* context using the [az aks get-credentials][az-aks-get-credentials] command. In a previous section, you set the context using the cluster admin credentials. The admin user bypasses Azure AD signin prompts. Without the `--admin` parameter, the user context is applied that requires all requests to be authenticated using Azure AD.
310
+
First, reset the *kubeconfig* context using the [az aks get-credentials][az-aks-get-credentials] command. In a previous section, you set the context using the cluster admin credentials. The admin user bypasses Azure AD sign-in prompts. Without the `--admin` parameter, the user context is applied that requires all requests to be authenticated using Azure AD.
284
311
285
312
```azurecli-interactive
286
313
az aks get-credentials --resource-group myResourceGroup --name myAKSCluster --overwrite-existing
@@ -292,7 +319,7 @@ Schedule a basic NGINX pod using the [kubectl run][kubectl-run] command in the *
292
319
kubectl run nginx-dev --image=mcr.microsoft.com/oss/nginx/nginx:1.15.5-alpine --namespace dev
293
320
```
294
321
295
-
As the signin prompt, enter the credentials for your own `[email protected]` account created at the start of the article. Once you are successfully signed in, the account token is cached for future `kubectl` commands. The NGINX is successfully schedule, as shown in the following example output:
322
+
As the sign-in prompt, enter the credentials for your own `[email protected]` account created at the start of the article. Once you are successfully signed in, the account token is cached for future `kubectl` commands. The NGINX is successfully schedule, as shown in the following example output:
296
323
297
324
```console
298
325
$ kubectl run nginx-dev --image=mcr.microsoft.com/oss/nginx/nginx:1.15.5-alpine --namespace dev
@@ -435,3 +462,4 @@ For best practices on identity and resource control, see [Best practices for aut
0 commit comments