Skip to content

Commit ec62438

Browse files
authored
Merge pull request #100908 from sauryadas/master
Update azure-disk-customer-managed-keys.md
2 parents 4031237 + f421f40 commit ec62438

File tree

1 file changed

+10
-19
lines changed

1 file changed

+10
-19
lines changed

articles/aks/azure-disk-customer-managed-keys.md

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ author: mlearned
66

77
ms.service: container-service
88
ms.topic: article
9-
ms.date: 01/09/2020
9+
ms.date: 01/12/2020
1010
ms.author: mlearned
1111
---
1212

@@ -57,7 +57,7 @@ az account list-locations
5757
az group create -l myAzureRegionName -n myResourceGroup
5858
5959
# Create an Azure Key Vault resource in a supported Azure region
60-
az keyvault create -n myKeyVaultName -g myResourceGroup-l myAzureRegionName --enable-purge-protection true --enable-soft-delete true
60+
az keyvault create -n myKeyVaultName -g myResourceGroup -l myAzureRegionName --enable-purge-protection true --enable-soft-delete true
6161
```
6262

6363
## Create an instance of a DiskEncryptionSet
@@ -72,7 +72,7 @@ keyVaultId=$(az keyvault show --name myKeyVaultName --query [id] -o tsv)
7272
keyVaultKeyUrl=$(az keyvault key show --vault-name myKeyVaultName --name myKeyName --query [key.kid] -o tsv)
7373
7474
# Create a DiskEncryptionSet
75-
az disk-encryption-set create -n myDiskEncryptionSetName -l myAzureRegionName -g myResourceGroup--source-vault $keyVaultId --key-url $keyVaultKeyUrl
75+
az disk-encryption-set create -n myDiskEncryptionSetName -l myAzureRegionName -g myResourceGroup --source-vault $keyVaultId --key-url $keyVaultKeyUrl
7676
```
7777

7878
## Grant the DiskEncryptionSet resource access to the key vault
@@ -81,46 +81,37 @@ Use the DiskEncryptionSet and resource groups you created on the prior steps, an
8181

8282
```azurecli-interactive
8383
# Retrieve the DiskEncryptionSet value and set a variable
84-
desIdentity=$(az disk-encryption-set show -n myDiskEncryptionSetName -g myResourceGroup--query [identity.principalId] -o tsv)
84+
desIdentity=$(az disk-encryption-set show -n myDiskEncryptionSetName -g myResourceGroup --query [identity.principalId] -o tsv)
8585
8686
# Update security policy settings
87-
az keyvault set-policy -n myKeyVaultName -g myResourceGroup--object-id $desIdentity --key-permissions wrapkey unwrapkey get
87+
az keyvault set-policy -n myKeyVaultName -g myResourceGroup --object-id $desIdentity --key-permissions wrapkey unwrapkey get
8888
8989
# Assign the reader role
9090
az role assignment create --assignee $desIdentity --role Reader --scope $keyVaultId
9191
```
9292

9393
## Create a new AKS cluster and encrypt the OS disk with a customer-manged key
9494

95-
Create a new resource group and AKS cluster, then use your key to encrypt the OS disk.
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
9696

9797
```azurecli-interactive
9898
# Retrieve the DiskEncryptionSet value and set a variable
99-
diskEncryptionSetId=$(az resource show -n $diskEncryptionSetName -g ssecmktesting --resource-type "Microsoft.Compute/diskEncryptionSets" --query [id] -o tsv)
99+
diskEncryptionSetId=$(az resource show -n diskEncryptionSetName -g myResourceGroup --resource-type "Microsoft.Compute/diskEncryptionSets" --query [id] -o tsv)
100100
101101
# Create a resource group for the AKS cluster
102102
az group create -n myResourceGroup-l myAzureRegionName
103103
104104
# Create the AKS cluster
105-
az aks create -n myAKSCluster -g myResourceGroup --node-osdisk-diskencryptionsetid diskEncryptionId
105+
az aks create -n myAKSCluster -g myResourceGroup --node-osdisk-diskencryptionset-id $diskEncryptionSetId --kubernetes-version 1.17.0
106106
```
107107

108-
## Add a node pool to an existing AKS cluster and encrypt the OS disk with a customer-managed key
109-
110-
New nodepools do not use encrypted disks by default. You can add a new node pool to an existing cluster and encrypt the OS disk with your own key by using the following command.
111-
112-
```azurecli-interactive
113-
# Add a nodepool to an existing cluster with BYOK encryption
114-
nodepool add –-cluster-name myAKSCluster -n myNodePoolName -g myResourceGroup --node-osdisk-diskencryptionsetid diskEncryptionId
115-
```
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
116109

117110
## Encrypt your AKS cluster data disk with a customer-managed key
118111

119112
You can also encrypt the AKS data disks with your own keys. Replace myResourceGroup and myDiskEncryptionSetName with your real values, and apply the yaml.
120113

121-
### Deploy the sample image from ACR to AKS
122-
123-
Ensure you have the proper AKS credentials
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.
124115

125116
Create a file called **byok-azure-disk.yaml** that contains the following information. Replace myResourceGroup and myDiskEncrptionSetName with your values.
126117

0 commit comments

Comments
 (0)