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/access-control-managed-azure-ad.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -95,7 +95,13 @@ When you integrate Microsoft Entra ID with your AKS cluster, you can use [Condit
95
95
6. Create the AKS cluster with AKS-managed Microsoft Entra integration using the [`az aks create`][az-aks-create] command with the `--aad-admin-group-objects-ids` and `--aad-tenant-id parameters` and include the values noted in the steps earlier.
96
96
97
97
```azurecli-interactive
98
-
az aks create --resource-group myResourceGroup --name myManagedCluster --enable-aad --aad-admin-group-object-ids <object-id> --aad-tenant-id <tenant-id>
98
+
az aks create \
99
+
--resource-group myResourceGroup \
100
+
--name myManagedCluster \
101
+
--enable-aad \
102
+
--aad-admin-group-object-ids <object-id> \
103
+
--aad-tenant-id <tenant-id> \
104
+
--generate-ssh-keys
99
105
```
100
106
101
107
7. In the Azure portal, select **Activity** > **Privileged Access (Preview)** > **Enable Privileged Access**.
Copy file name to clipboardExpand all lines: articles/aks/azure-cni-overlay.md
-3Lines changed: 0 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -252,8 +252,6 @@ The following attributes are provided to support dual-stack clusters:
252
252
--generate-ssh-keys
253
253
```
254
254
255
-
---
256
-
257
255
## Create an example workload
258
256
259
257
Once the cluster has been created, you can deploy your workloads. This article walks you through an example workload deployment of an NGINX web server.
@@ -383,4 +381,3 @@ To learn how to utilize AKS with your own Container Network Interface (CNI) plug
Copy file name to clipboardExpand all lines: articles/aks/configure-kubenet.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -159,7 +159,7 @@ For more information to help you decide which network model to use, see [Compare
159
159
160
160
#### Create a managed identity
161
161
162
-
* Create a managed identity using the [`az identity`][az-identity-create] command. If you have an existing managed identity, find the Principal ID using the `az identity show --ids <identity-resource-id>` command instead.
162
+
* Create a managed identity using the [`az identity`][az-identity-create] command. If you have an existing managed identity, find the principal ID using the `az identity show --ids <identity-resource-id>` command instead.
163
163
164
164
```azurecli-interactive
165
165
az identity create --name myIdentity --resource-group myResourceGroup
@@ -239,7 +239,7 @@ Kubenet networking requires organized route table rules to successfully route re
239
239
* Using the same route table with multiple AKS clusters isn't supported.
240
240
241
241
> [!NOTE]
242
-
> When you create and use your own VNet and route table with the kubenet network plugin, you need to use a [user-assigned control plane identity][bring-your-own-control-plane-managed-identity]. For a system-assigned control plane identity, you can't retrieve the identity ID before creating a cluster, which causes a delay during role assignment.
242
+
> When you create and use your own VNet and route table with the kubenet network plugin, you must configure a [user-assigned managed identity][bring-your-own-control-plane-managed-identity] for the cluster. With a system-assigned managed identity, you can't retrieve the identity ID before creating a cluster, which causes a delay during role assignment.
243
243
>
244
244
> Both system-assigned and user-assigned managed identities are supported when you create and use your own VNet and route table with the Azure network plugin. We highly recommend using a user-assigned managed identity for BYO scenarios.
245
245
@@ -295,4 +295,4 @@ This article showed you how to deploy your AKS cluster into your existing virtua
# Use a service principal with Azure Kubernetes Service (AKS)
16
16
17
-
An AKS cluster requires either an[Microsoft Entra service principal][aad-service-principal] or a [managed identity][managed-identity-resources-overview] to dynamically create and manage other Azure resources, such as an Azure Load Balancer or Azure Container Registry (ACR).
17
+
An AKS cluster requires either a[Microsoft Entra service principal][aad-service-principal] or a [managed identity][managed-identity-resources-overview] to dynamically create and manage other Azure resources, such as an Azure Load Balancer or Azure Container Registry (ACR).
18
18
19
-
> [!NOTE]
20
-
> We recommend using managed identities to authenticate with other resources in Azure, and they're the default authentication method for your AKS cluster. For more information about using a managed identity with your cluster, see [Use a system-assigned managed identity][use-managed-identity].
19
+
For optimal security and ease of use, Microsoft recommends using managed identities rather than service principals to authorize access from an AKS cluster to other resources in Azure. A managed identity is a special type of service principal that can be used to obtain Microsoft Entra credentials without the need to manage and secure credentials. For more information about using a managed identity with your cluster, see [Use a managed identity in AKS][use-managed-identity].
21
20
22
-
This article shows you how to create and use a service principal for your AKS clusters.
21
+
This article shows you how to create and use a service principal with your AKS clusters.
23
22
24
23
## Before you begin
25
24
26
-
To create a Microsoft Entra service principal, you must have permissions to register an application with your Microsoft Entra tenant and to assign the application to a role in your subscription. If you don't have the necessary permissions, you need to ask your Microsoft Entra ID or subscription administrator to assign the necessary permissions or pre-create a service principal for you to use with your AKS cluster.
25
+
To create a Microsoft Entra service principal, you must have permissions to register an application with your Microsoft Entra tenant and to assign the application to a role in your subscription. If you don't have the necessary permissions, you need to ask your Microsoft Entra ID or subscription administrator to assign the necessary permissions or pre-create a service principal for use with your AKS cluster.
27
26
28
27
If you're using a service principal from a different Microsoft Entra tenant, there are other considerations around the permissions available when you deploy the cluster. You may not have the appropriate permissions to read and write directory information. For more information, see [What are the default user permissions in Microsoft Entra ID?][azure-ad-permissions]
29
28
@@ -32,7 +31,9 @@ If you're using a service principal from a different Microsoft Entra tenant, the
32
31
* If using Azure CLI, you need Azure CLI version 2.0.59 or later. Run `az --version` to find the version. If you need to install or upgrade, see [Install Azure CLI][install-azure-cli].
33
32
* If using Azure PowerShell, you need Azure PowerShell version 5.0.0 or later. Run `Get-InstalledModule -Name Az` to find the version. If you need to install or upgrade, see [Install the Azure Az PowerShell module][install-the-azure-az-powershell-module].
34
33
35
-
## Manually create a service principal
34
+
## Create a service principal
35
+
36
+
Create a service principal before you create your cluster.
36
37
37
38
### [Azure CLI](#tab/azure-cli)
38
39
@@ -126,33 +127,45 @@ If you're using a service principal from a different Microsoft Entra tenant, the
126
127
127
128
## Delegate access to other Azure resources
128
129
129
-
You can use the service principal for the AKS cluster to access other resources. For example, if you want to deploy your AKS cluster into an existing Azure virtual network subnet or connect to Azure Container Registry (ACR), you need to delegate access to those resources to the service principal. Permission granted to a cluster using a system-assigned managed identity may take up 60 minutes to populate.
130
+
You can use the service principal for the AKS cluster to access other resources. For example, if you want to deploy your AKS cluster into an existing Azure virtual network subnet, connect to Azure Container Registry (ACR), or access keys or secrets in a key vault from your cluster, then you need to delegate access to those resources to the service principal. To delegate access, assign an Azure role-based access control (Azure RBAC) role to the service principal.
131
+
132
+
> [!IMPORTANT]
133
+
> Permissions granted to a service principal associated with a cluster may take up 60 minutes to propagate.
130
134
131
135
### [Azure CLI](#tab/azure-cli)
132
136
133
-
* Create a role assignment using the [`az role assignment create`][az-role-assignment-create] command. Assign the `appId` to a particular scope, such as a resource group or virtual network resource. The role defines what permissions the service principal has on the resource.
137
+
* Create a role assignment using the [`az role assignment create`][az-role-assignment-create] command. Provide the value of the service principal's appID for the `appId` parameter. Specify the scope for the role assignment, such as a resource group or virtual network resource. The role assignment determines what permissions the service principal has on the resource and at what scope.
134
138
135
-
> [!NOTE]
136
-
> The `--scope` for a resource needs to be a full resource ID, such as */subscriptions/\<guid\>/resourceGroups/myResourceGroup* or */subscriptions/\<guid\>/resourceGroups/myResourceGroupVnet/providers/Microsoft.Network/virtualNetworks/myVnet*.
139
+
For example, to assign the service principal permissions to access secrets in a key vault, you might use the following command:
137
140
138
141
```azurecli-interactive
139
-
az role assignment create --assignee <appId> --scope <resourceScope> --role Contributor
> The `--scope` for a resource needs to be a full resource ID, such as */subscriptions/\<guid\>/resourceGroups/myResourceGroup* or */subscriptions/\<guid\>/resourceGroups/myResourceGroupVnet/providers/Microsoft.Network/virtualNetworks/myVnet*.
150
+
142
151
### [Azure PowerShell](#tab/azure-powershell)
143
152
144
-
* Create a role assignment using the [`New-AzRoleAssignment`][new-azroleassignment] command. Assign the `ApplicationId` to a particular scope, such as a resource group or virtual network resource. The role defines what permissions the service principal has on the resource.
153
+
* Create a role assignment using the [`New-AzRoleAssignment`][new-azroleassignment] command. Provide the value of the service principal's appID for the `ApplicationId` parameter. Specify the scope for the role assignment, such as a resource group or virtual network resource. The role assignment determines what permissions the service principal has on the resource and at what scope.
145
154
146
-
> [!NOTE]
147
-
> The `Scope` for a resource needs to be a full resource ID, such as */subscriptions/\<guid\>/resourceGroups/myResourceGroup* or */subscriptions/\<guid\>/resourceGroups/myResourceGroupVnet/providers/Microsoft.Network/virtualNetworks/myVnet*
155
+
For example, to assign the service principal permissions to access secrets in a key vault, you might use the following command:
> The `Scope` for a resource needs to be a full resource ID, such as */subscriptions/\<guid\>/resourceGroups/myResourceGroup* or */subscriptions/\<guid\>/resourceGroups/myResourceGroupVnet/providers/Microsoft.Network/virtualNetworks/myVnet*
165
+
153
166
---
154
167
155
-
The following sections detail common delegations that you may need to assign.
168
+
The following sections detail common delegations that you may need to assign to a service principal.
156
169
157
170
### Azure Container Registry
158
171
@@ -196,7 +209,11 @@ When using AKS and a Microsoft Entra service principal, consider the following:
196
209
* To delete the service principal, query for your cluster's *servicePrincipalProfile.clientId* and delete it using the [`az ad sp delete`][az-ad-sp-delete] command. Replace the values for the `-g` parameter for the resource group name and `-n` parameter for the cluster name:
197
210
198
211
```azurecli
199
-
az ad sp delete --id $(az aks show -g myResourceGroup -n myAKSCluster --query servicePrincipalProfile.clientId -o tsv)
212
+
az ad sp delete --id $(az aks show \
213
+
--resource-group myResourceGroup \
214
+
--name myAKSCluster \
215
+
--query servicePrincipalProfile.clientId \
216
+
--output tsv)
200
217
```
201
218
202
219
### [Azure PowerShell](#tab/azure-powershell)
@@ -222,7 +239,7 @@ When using AKS and a Microsoft Entra service principal, consider the following:
222
239
223
240
### [Azure CLI](#tab/azure-cli)
224
241
225
-
Azure CLI caches the service principal credentials for AKS clusters. If these credentials expire, you encounter errors during AKS cluster deployment. If you run the [`az aks create`][az-aks-create] command and receive an error message similar to the following, it may indicate a problem with the cached service principal credentials:
242
+
Azure CLI caches the service principal credentials for AKS clusters. If these credentials expire, you can encounter errors during AKS cluster deployment. If you run the [`az aks create`][az-aks-create] command and receive an error message similar to the following, it may indicate a problem with the cached service principal credentials:
226
243
227
244
```azurecli
228
245
Operation failed with status: 'Bad Request'.
@@ -233,7 +250,10 @@ Details: The credentials in ServicePrincipalProfile were invalid. Please see htt
233
250
You can check the expiration date of your service principal credentials using the [`az ad app credential list`][az-ad-app-credential-list] command with the `"[].endDateTime"` query.
234
251
235
252
```azurecli
236
-
az ad app credential list --id <app-id> --query "[].endDateTime" -o tsv
253
+
az ad app credential list \
254
+
--id <app-id> \
255
+
--query "[].endDateTime" \
256
+
--output tsv
237
257
```
238
258
239
259
The default expiration time for the service principal credentials is one year. If your credentials are older than one year, you can [reset the existing credentials][reset-credentials] or [create a new service principal][new-service-principal].
0 commit comments