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/csi-secrets-store-identity-access.md
+29-18Lines changed: 29 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,36 +1,38 @@
1
1
---
2
-
title: Provide an access identity to the Azure Key Vault provider for Secrets Store CSI Driver for Azure Kubernetes Service (AKS) secrets
3
-
description: Learn how to integrate the Azure Key Vault provider for Secrets Store CSI Driver with your Azure key vault.
2
+
title: Access Azure Key Vault with the CSI Driver Identity Provider
3
+
description: Learn how to integrate the Azure Key Vault Provider for Secrets Store CSI Driver with your Azure credentials and user identities.
4
4
author: nickomang
5
5
ms.author: nickoman
6
6
ms.topic: article
7
-
ms.date: 10/19/2023
7
+
ms.date: 12/01/2023
8
8
ms.custom: devx-track-azurecli, devx-track-linux
9
9
---
10
10
11
-
# Provide an identity to access the Azure Key Vault provider for Secrets Store CSI Driver in Azure Kubernetes Service (AKS)
11
+
# Connect your Azure identity provider to the Azure Key Vault Secrets Store CSI Driver in Azure Kubernetes Service (AKS)
12
12
13
-
The Secrets Store CSI Driver on Azure Kubernetes Service (AKS) provides various methods of identity-based access to your Azure Key Vault. This article outlines these methods and how to use them to access your key vault and its contents from your AKS cluster.
13
+
The Secrets Store Container Storage Interface (CSI) Driver on Azure Kubernetes Service (AKS) provides various methods of identity-based access to your Azure Key Vault. This article outlines these methods and best practices for when to use Role-based access control (RBAC) or OpenID Connect (OIDC) security models to access your key vault and AKS cluster.
- Before you begin, make sure you followed the steps in [Use the Azure Key Vault provider for Secrets Store CSI Driver in an Azure Kubernetes Service (AKS) cluster][csi-secrets-store-driver] to create an AKS cluster with Azure Key Vault provider for Secrets Store CSI Driver support.
22
+
- Before you begin, make sure you finish the steps in [Use the Azure Key Vault provider for Secrets Store CSI Driver in an Azure Kubernetes Service (AKS) cluster][csi-secrets-store-driver] to enable the Azure Key Vault Secrets Store CSI Driver in your AKS cluster.
A [Microsoft Entra Workload ID][workload-identity] is an identity that an application running on a pod uses that authenticates itself against other Azure services that support it, such as Storage or SQL. It integrates with the native Kubernetes capabilities to federate with external identity providers. In this security model, the AKS cluster acts as token issuer. Microsoft Entra ID then uses OpenID Connect (OIDC) to discover public signing keys and verify the authenticity of the service account token before exchanging it for a Microsoft Entra token. Your workload can exchange a service account token projected to its volume for a Microsoft Entra token using the Azure Identity client library using the Azure SDK or the Microsoft Authentication Library (MSAL).
28
+
A [Microsoft Entra Workload ID][workload-identity] is an identity that an application running on a pod uses to authenticate itself against other Azure services, such as workloads in software. The Storage Store CSI Driver integrates with native Kubernetes capabilities to federate with external identity providers.
29
+
30
+
In this security model, the AKS cluster acts as token issuer. Microsoft Entra ID then uses OIDC to discover public signing keys and verify the authenticity of the service account token before exchanging it for a Microsoft Entra token. For your workload to exchange a service account token projected to its volume for a Microsoft Entra token, you need the Azure Identity client library in the Azure SDK or the Microsoft Authentication Library (MSAL)
29
31
30
32
> [!NOTE]
31
33
>
32
34
> - This authentication method replaces Microsoft Entra pod-managed identity (preview). The open source Microsoft Entra pod-managed identity (preview) in Azure Kubernetes Service has been deprecated as of 10/24/2022.
33
-
> - Microsoft Entra Workload ID is supported on both Windows and Linux clusters.
35
+
> - Microsoft Entra Workload ID is supports both Windows and Linux clusters.
34
36
35
37
### Configure workload identity
36
38
@@ -70,7 +72,7 @@ A [Microsoft Entra Workload ID][workload-identity] is an identity that an applic
70
72
echo $AKS_OIDC_ISSUER
71
73
```
72
74
73
-
5. Establish a federated identity credential between the Microsoft Entra application and the service account issuer and subject. Get the object ID of the Microsoft Entra application using the following commands. Make sure to update the values for `serviceAccountName` and `serviceAccountNamespace` with the Kubernetes service account name and its namespace.
75
+
5. Establish a federated identity credential between the Microsoft Entra application, service account issuer, and subject. Get the object ID of the Microsoft Entra application using the following commands. Make sure to update the values for `serviceAccountName` and `serviceAccountNamespace` with the Kubernetes service account name and its namespace.
74
76
75
77
```bash
76
78
export SERVICE_ACCOUNT_NAME="workload-identity-sa" # sample name; can be changed
@@ -126,7 +128,7 @@ A [Microsoft Entra Workload ID][workload-identity] is an identity that an applic
126
128
```
127
129
128
130
> [!NOTE]
129
-
> If you use `objectAlias` instead of `objectName`, make sure to update the YAML script.
131
+
> If you use `objectAlias` instead of `objectName`, update the YAML script to account for it.
130
132
131
133
8. Deploy a sample pod using the `kubectl apply` command and the following YAML script.
132
134
@@ -161,9 +163,17 @@ A [Microsoft Entra Workload ID][workload-identity] is an identity that an applic
A [Microsoft Entra Managed ID][managed-identity] is an identity that an administrator uses to authenticate themselves against other Azure services. The managed identity uses RBAC to federate with external identity providers.
171
+
172
+
In this security model, you can grant access to your cluster's resources to team members or tenants sharing a managed role. The role is checked for scope to access the keyvault and other credentials. When you [enabled the Azure Key Vault provider for Secrets Store CSI Driver on your AKS Cluster](./csi-secrets-store-driver.md#create-an-aks-cluster-with-azure-key-vault-provider-for-secrets-store-csi-driver-support), it created a user identity.
173
+
174
+
### Configure managed identity
165
175
166
-
1. Access your key vault using the [`az aks show`][az-aks-show] command and the user-assigned managed identity created by the add-on when you [enabled the Azure Key Vault provider for Secrets Store CSI Driver on your AKS Cluster](./csi-secrets-store-driver.md#create-an-aks-cluster-with-azure-key-vault-provider-for-secrets-store-csi-driver-support).
176
+
1. Access your key vault using the [`az aks show`][az-aks-show] command and the user-assigned managed identity created by the add-on.
167
177
168
178
```azurecli-interactive
169
179
az aks show -g <resource-group> -n <cluster-name> --query addonProfiles.azureKeyvaultSecretsProvider.identity.clientId -o tsv
@@ -177,7 +187,7 @@ A [Microsoft Entra Workload ID][workload-identity] is an identity that an applic
177
187
az vm identity assign -g <resource-group> -n <agent-pool-vm> --identities <identity-resource-id>
178
188
```
179
189
180
-
2. Create a role assignment that grants the identity permission to access the key vault secrets, access keys, and certificates using the [`az role assignment create`][az-role-assignment-create] command.
190
+
2. Create a role assignment that grants the identity permission access to the key vault secrets, access keys, and certificates using the [`az role assignment create`][az-role-assignment-create] command.
@@ -258,9 +268,9 @@ A [Microsoft Entra Workload ID][workload-identity] is an identity that an applic
258
268
kubectl apply -f pod.yaml
259
269
```
260
270
261
-
## Validate the secrets
271
+
## Validate Key Vault secrets
262
272
263
-
After the pod starts, the mounted content at the volume path that you specified in your deployment YAML is available. Use the following commands to validate your secrets and print a test secret.
273
+
After the pod starts, the mounted content at the volume path specified in your deployment YAML is available. Use the following commands to validate your secrets and print a test secret.
264
274
265
275
1. Show secrets held in the secrets store using the following command.
266
276
@@ -276,7 +286,7 @@ After the pod starts, the mounted content at the volume path that you specified
276
286
277
287
## Obtain certificates and keys
278
288
279
-
The Azure Key Vault design makes sharp distinctions between keys, secrets, and certificates. The certificate features of the Key Vault service were designed to make use of key and secret capabilities. When you create a key vault certificate, it creates an addressable key and secret with the same name. The key allows key operations, and the secret allows the retrieval of the certificate value as a secret.
289
+
The Azure Key Vault design makes sharp distinctions between keys, secrets, and certificates. The certificate features of the Key Vault service are designed to make use of key and secret capabilities. When you create a key vault certificate, it creates an addressable key and secret with the same name. This key allows authentication operations, and the secret allows the retrieval of the certificate value as a secret.
280
290
281
291
A key vault certificate also contains public x509 certificate metadata. The key vault stores both the public and private components of your certificate in a secret. You can obtain each individual component by specifying the `objectType` in `SecretProviderClass`. The following table shows which objects map to the various resources associated with your certificate:
282
292
@@ -286,7 +296,7 @@ A key vault certificate also contains public x509 certificate metadata. The key
286
296
|`cert`|The certificate, in PEM format.|No|
287
297
|`secret`|The private key and certificate, in PEM format.|Yes|
288
298
289
-
## Disable the Azure Key Vault provider for Secrets Store CSI Driver on an existing AKS cluster
299
+
## Disable the addon on existing clusters
290
300
291
301
> [!NOTE]
292
302
> Before you disable the add-on, ensure that *no* `SecretProviderClass` is in use. Trying to disable the add-on while a `SecretProviderClass` exists results in an error.
@@ -313,6 +323,7 @@ In this article, you learned how to create and provide an identity to access you
0 commit comments