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-disk-customer-managed-keys.md
+55-19Lines changed: 55 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,11 +15,11 @@ ms.author: mlearned
15
15
Azure Storage encrypts all data in a storage account at rest. By default, data is encrypted with Microsoft-managed keys. For additional control over encryption keys, you can supply [customer-managed keys][customer-managed-keys] to use for encryption of both the OS and data disks for your AKS clusters.
16
16
17
17
> [!NOTE]
18
-
> Linux and Windows based AKS clusters are both supported.
18
+
> BYOK Linux and Windows based AKS clusters are available in [Azure regions][supported-regions] that support server side encryption of Azure managed disks.
19
19
20
20
## Before you begin
21
21
22
-
* This article assumes that you are creating a *new AKS cluster*. You will also need to use or create an instance of Azure Key Vault to store your encryption keys.
22
+
* This article assumes that you are creating a *new AKS cluster*.
23
23
24
24
* You must enable soft delete and purge protection for *Azure Key Vault* when using Key Vault to encrypt managed disks.
25
25
@@ -43,16 +43,18 @@ az extension add --name aks-preview
43
43
az extension update --name aks-preview
44
44
```
45
45
46
-
## Create an Azure Key Vault instance to store your keys
46
+
## Create an Azure Key Vault instance
47
47
48
-
You can optionally use the Azure portal to [Configure customer-managed keys with Azure Key Vault][byok-azure-portal]
48
+
Use an Azure Key Vault instance to store your keys. You can optionally use the Azure portal to [Configure customer-managed keys with Azure Key Vault][byok-azure-portal]
49
49
50
-
Create a new *resource group*, then create a new *Key Vault* instance and enable soft delete and purge protection.
50
+
Create a new *resource group*, then create a new *Key Vault* instance and enable soft delete and purge protection. Ensure you use the same region and resource group names for each command.
51
51
52
52
```azurecli-interactive
53
53
# Optionally retrieve Azure region short names for use on upcoming commands
54
54
az account list-locations
55
+
```
55
56
57
+
```azurecli-interactive
56
58
# Create new resource group in a supported Azure region
57
59
az group create -l myAzureRegionName -n myResourceGroup
You will need a *key* stored in Azure Key Vault to complete the following steps. Either store your existing Key in the Key Vault you created, or [generate a key][key-vault-generate]
67
+
Replace *myKeyVaultName* with the name of your key vault. You will also need a *key* stored in Azure Key Vault to complete the following steps. Either store your existing Key in the Key Vault you created on the previous steps, or [generate a new key][key-vault-generate] and replace *myKeyName* below with the name of your key.
66
68
67
69
```azurecli-interactive
68
70
# Retrieve the Key Vault Id and store it in a variable
az role assignment create --assignee $desIdentity --role Reader --scope $keyVaultId
91
93
```
92
94
93
-
## Create a new AKS cluster and encrypt the OS disk with a customer-manged key
95
+
## Create a new AKS cluster and encrypt the OS disk
96
+
97
+
Create a **new resource group** and AKS cluster, then use your key to encrypt the OS disk. Customer-managed keys are only supported in kubernetes versions greater than 1.17.
94
98
95
-
Create a new resource group and AKS cluster, then use your key to encrypt the OS disk. Customer managed key is only supported in kubernetes versions greater than 1.17
99
+
> [!IMPORTANT]
100
+
> Ensure you create a new resoruce group for your AKS cluster
96
101
97
102
```azurecli-interactive
98
103
# Retrieve the DiskEncryptionSet value and set a variable
az group create -n myResourceGroup-l myAzureRegionName
107
+
az group create -n myResourceGroup-l myAzureRegionName
103
108
104
109
# Create the AKS cluster
105
-
az aks create -n myAKSCluster -g myResourceGroup --node-osdisk-diskencryptionset-id $diskEncryptionSetId --kubernetes-version 1.17.0
110
+
az aks create -n myAKSCluster -g myResourceGroup --node-osdisk-diskencryptionset-id $diskEncryptionSetId --kubernetes-version 1.17.0 --generate-ssh-keys
106
111
```
107
112
108
-
When new node pools are added to the cluster created above, the customer managed key provided during the create is used to encrypt the OS disk
113
+
When new node pools are added to the cluster created above, the customer-managed key provided during the create is used to encrypt the OS disk.
114
+
115
+
## Encrypt your AKS cluster data disk
116
+
117
+
You can also encrypt the AKS data disks with your own keys.
109
118
110
-
## Encrypt your AKS cluster data disk with a customer-managed key
119
+
> [!IMPORTANT]
120
+
> Ensure you have the proper AKS credentials. The Service principal will need to have contributor access to the resource group where the diskencryptionset is deployed. Otherwise, you will get an error suggesting that the service principal does not have permissions.
111
121
112
-
You can also encrypt the AKS data disks with your own keys. Replace myResourceGroup and myDiskEncryptionSetName with your real values, and apply the yaml.
122
+
```azurecli-interactive
123
+
# Retrieve your Azure Subscription Id from id property as shown below
124
+
az account list
125
+
```
113
126
114
-
Ensure you have the proper AKS credentials. The Service principal will need to have contributor access to the resource group where the diskencryptionset is present. Otherwise, you will get an error suggesting that the service principal does not have permissions.
Create a file called **byok-azure-disk.yaml** that contains the following information. Replace myResourceGroup and myDiskEncrptionSetName with your values.
146
+
Create a file called **byok-azure-disk.yaml** that contains the following information. Replace myAzureSubscriptionId, myResourceGroup, and myDiskEncrptionSetName with your values, and apply the yaml. Make sure to use the resource group where your DiskEncryptionSet is deployed. If you use the Azure Cloud Shell, this file can be created using vi or nano as if working on a virtual or physical system:
0 commit comments